H.E.L.P. with JDBC driver

From: Richard Cuello <rc370_at_columbia.edu>
Date: Thu, 05 Aug 1999 09:31:04 -0400
Message-ID: <37A99218.20478A45_at_columbia.edu>



[Quoted] Hi Java and Oracle jedi's,

[Quoted] Below is an JDBC driver. I have already initiated it with the user and [Quoted] password field. Below at (_at_lambdael:1521:itchy) I need to substitute the [Quoted] url and machine fields. I jave oracle 8 installed on my personal computer which is running on my windows workstation NT. I'm not connected to a server. Any suggestions on what I should substitute to get a connection to my database?

Thanks,
 Richard


[Quoted] //Make sure you set the classpath pointing to the folder of your classes111.zip
//as well as the classpath where your classes are saved. //set CLASSPATH=C:\Program Files\Oracle\AppBuilder 1.0\jdbc\lib\Classes111.zip;c:\ndesjard\java

import java.sql.Connection; 
import java.sql.DriverManager; 
import java.sql.SQLException; 

/**

* The SimpleConnection class is a command line application 
* that accepts the following command line:
* java SimpleConnection DRIVER URL UID PASSWORD
* If the URL fits the specified driver, it will then load the driver and
get a connection
*/

class SimpleConnection {
[Quoted]   public static void main(String args[]){

    Connection connection = null;     

    // Process the command line
    if (args.length != 4) {

       System.out.println("Syntax: java SimpleConnection " + "DRIVER URL UID PASSWORD");
       return;
}

[Quoted]     try{ //load the driver "oracle.jdbc.driver.OracleDriver"

       Class.forName(args[0]);
}

    catch(Exception e){

       e.printStackTrace();
       //System.out.println("Failed to load Oracle driver");
       return;

}

    try { //"jdbc:oracle:thin:_at_lambdael:1521:itchy", "cta", "student" );    // connection =
DriverManager.getConnection("jdbc:oracle:thin:_at_lambdael:1521:itchy", "cta", "student" );

[Quoted]       connection = DriverManager.getConnection(args[1], args[2], args[3]);

      System.out.println("Connection Successful");

      //Do whatever queries or updates here
      //Statement stmt = conn.createStatement (); 
      //ResultSet rset = stmt.executeQuery ("select * from course");

}

    catch(SQLException e) {

       e.printStackTrace();
}

    finally {

       try {
         connection.close();
       }
       catch(SQLException e) {
         e.printStackTrace();
       }

}

  }
} Received on Thu Aug 05 1999 - 15:31:04 CEST

Original text of this message