Lab2: Simple JDBC

  1. Accessing the Oracle database server:

    Using a text-based client:

    a.) Login on any Sun machine (e.g. orcus.cs.uchicago.edu or urania.cs.uchicago.edu)

    b.) Run: 

        sqlplus <user>@$ORACLE_DB

    (replace <user> with your database user name communicated by Mark)

    c.) More information on using sqlplus and SQL is available here. (Please ignore "Getting an account" and "Logging-in" sections)

    Using a graphical interface:

    a.) Install it somewhere in your home directory.  Run the following on a Linux machine.

    /stage/classes/current/51024-1/packages/linux-install-isql-2.1.4.bin

    b.) Edit the file <YOUR_INSTALL_DIR>/iSQL_Viewer/iSQL-Viewer.lax 

    b1) Add /opt/java/jdbc/oracle12.jar to lax.class.path

    b2) The line that defines lax.nl.current.vm should look like this:

    lax.nl.current.vm=/opt/java/jdk1.3.1_11/jre/bin/java

    c.) Start your sql viewer

    <YOUR_INSTALL_DIR>/iSQL_Viewer/iSQL-Viewer

    d.) Configure iSQL-Viewwe it to hit your database:

    • Click the " Service Manager " Button (Under the tools menu) and add a new service 
    • Connection name: ORACLE
    • JDBC driver: oracle.jdbc.driver.OracleDriver
    • URL: jdbc:oracle:thin:@limani.cs.uchicago.edu:1521:cs51024
    • Enter you username and passwd and uncheck the appropriate box

    e.) Connect to the database.

  1. Take a look at this simple JDBC program that does a SELECT and understand how it works.  Copy the code into your directory, then compile and run it 

    Ask questions! Sun's JDBC tutorial  or Mark's JDBC slides might be helpful to understand what's going on. 

  2. Resources:
      JDBC Home Page
      JDBC tutorial
      Programming examples

      JDBC Short Course:  Using MetaData

     

  3. Start working on Assignment 2 (which, if you successfully did all of the above, you will have practically finished.).

ta-51024@cs.uchicago.edu