Using Java Program for Implementation HW 6
Steps for loading the given program into Eclipse
- Download Eclipse Java environment from here.
Make sure you have Java installed on your machine. If not, install it first.
You can download Java from here.
- Run Eclipse. It might ask you for a workspace folder where it will store your
program code etc. Specify a folder and proceed. Remember to use the same folder
whenever you use Eclipse for this homework.
- Once Eclipse loads, create a new project. You will see a 'New Project' dialog
box. Choose 'Java Project' under 'Java'. Click 'Next'. Assign a project name
on the next screen, and click 'Finish'. You should now see your project in the
left panel called Package Explorer.
- Expand your project name in Package Explorer. Drag and drop 'Loader.java' file
into the 'src' folder. The file will show up under 'default package'.
- Drag and drop 'ojdbc14.jar' file on the project. It will show up directly under
the project (not inside src folder).
- Right click your project and choose 'Properties'. On the properties screen,
select 'Java Build Path'. Click on 'Libraries' tab. Click 'Add JARs...' button.
Expand your project in the 'JAR Selection' dialog box and choose 'ojdbc14.jar'.
(If you have already selected that file, it won't show up in the dialog again).
Once you close that dialog, you should see 'ojdbc14.jar' in the list of 'JARs
and class folder on the build path'. Press 'OK' to close properties box.
- Now you are ready to run your program. A round green 'play' button on the toolbar
will let you run your program. A button with 'bug' icon next to the 'Run' button
can be used for debugging programs.
Steps before running the program
-
Lines 6-7 in the program specify your user name and password. The values assigned
to the variables are currently dummy values. You need to change that to your
actual Oracle user name and password.
-
Line 12 in the program specifies the number of rows to be inserted into the
database. It is currently set to 1000 for testing. Remember, you need to provide
experiment results on a million rows. Obviously you will need to change that value.
-
Line 15 in the program is for setting loading variation. The default value is set
to 1, which means sorted data. For unsorted data, you should change this value to
2, and then run the program.
How to?
- ... do a SELECT query using JDBC? [Link]
- ... connect to the Oracle database? See Line 27-31 in Loader.java
- ... time the operations? Line 82 in Loader.java gets current clock
time before the load, and line 89 gets the current clock time right after the
load. Line 90 takes the difference between those two times to find the amount of
time taken by the load operation. This time is in milliseconds.