Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: H.E.L.P. with JDBC driver

Re: H.E.L.P. with JDBC driver

From: <tedchyn_at_yahoo.com>
Date: Thu, 05 Aug 1999 18:25:35 GMT
Message-ID: <7ockuf$n3i$1@nnrp1.deja.com>


In article <37A99218.20478A45_at_columbia.edu>,   Richard Cuello <rc370_at_columbia.edu> wrote:
> Hi Java and Oracle jedi's,
>
> Below is an JDBC driver. I have already initiated it with the user
and
> password field. Below at (@lambdael:1521:itchy) I need to substitute
the
> 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

richard,
DriverManager.getConnection("jdbc:oracle:thin:@lambdael:1521:itchy", "cta", "student" );
Is lambdael hostname for your pc ? If it is this name need to exists in /winnt/system32/drivers/etc/hosts, tnsnames.ora,listner.ora file. what error message you are trying to make connection ? Ted
> ______________________________________________________________________
>
> //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 {
> 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;
> }
> 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:@lambdael:1521:itchy", "cta", "student"
);
> // connection =
> DriverManager.getConnection("jdbc:oracle:thin:@lambdael:1521:itchy",
> "cta", "student" );
> 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();
> }
> }
> }
> }
>

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Thu Aug 05 1999 - 13:25:35 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US