Using JDBC at GWU


Documentation


Changes to your .profile or .cshrc

You need to modify your CLASSPATH variable to add two paths.

If you are using K-shell (the default at GWU), include the following line at the bottom of your .profile file:


export CLASSPATH=$CLASSPATH:/apps/sql_jdbc/classes11:/apps/sql_jdbc/java122
   

If you are using tcsh, add the following line to your .cshrc file:


setenv CLASSPATH $CLASSPATH:/apps/sql_jdbc/classes11:/apps/sql_jdbc/java122
    

Once you've made these changes you need to log out and log back in so that they are in effect.


Setting up the display

Next set up your display so that the machine delphi can bring up a window on your machine. Use these instructions.

Test whether the display is working by running an old java program that brings up a window.


Running JDBCTest

Next, you need to run JDBCTest (This is a Java program provided by InterSolv) to do two things:

  1. Register the JDBC Driver with Oracle.
  2. See for yourself that things are working.

Here is what you need to do to bring up JDBCTest.

  • cd to the directory /apps/sql_jdbc/jdbctest/classes.
  • Run JDBCTest (which is a Java class file) as follows:
    
        % java JDBCTest Config.txt
        
  • This should bring up a window. If not, one of the following is not working:
    • Your display is not set up correctly.
    • Your CLASSPATH is not correctly set up.
    • You've mis-typed something in running JDBCTest.

Next, use JDBCTest: (assuming you were able to bring up the JDBCTest window)

  • Click on "Continue" when the image appears.
  • Now you will get a window with menus like "File", "Driver" and "Connection".
  • In the "Driver" menu, click on "Register Driver ..."
    • You will get a TextField.
    • If this TextField already has the string
      
              intersolv.jdbc.sequelink.SequeLinkDriver       
      	
      then you don't need to do anything. Click on Cancel.
    • If not, in this textfield, enter the string (it is case-sensitive)
      
             intersolv.jdbc.sequelink.SequeLinkDriver      
             
      and click on OK.
    • This should register the driver. You should get a confirmation message in the main window. If not, something is terribly wrong.
  • Next, assuming the registering worked, in the "Connection" menu click on "Connect to DB...".
  • This will bring up a window called "Select a Database".
    • Here, there are three textfields: a Database, a username and a password.
    • You will also get a list of possible templates to use for a Database. You don't have to use these. If you want to, however, click on one that has Oracle and OSUser in the same string.
    • This will place the string in the Database textfield, which you can then edit to get the string below.
    • Basically, here's what you need to have in the Database textfield:
      
             jdbc:sequelink://delphi:4003/[Oracle];OSUser=john;OSPassword=whatever
             
    • Next, edit this textfield so that instead of john enter your delphi (Unix) username and instead of whatever enter your delphi (Unix, NOT Oracle) password.
    • Next, in the textfield for username, enter your ORACLE username.
    • Next, in the textfield for password, enter your ORACLE password. (Thus, your Oracle password and Unix passwords are both required by JDBC).
    • Finally, click on the "connect" button.
    • It should work: you will get a new window if it does.
    • If it doesn't look at the error message (in the main window) in detail.
If everything is working, you need never run JDBCTest again. If at some later time, your JDBC code doesn't work, then you may want to come back to JDBCTest and try it again.

One interesting thing to note: the JDBC test program displays the Java code it uses for any test, so that you can copy over the code for those particular actions.