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

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

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

From: C. Ferguson <c_ferguson_at_rationalconcepts.com>
Date: Thu, 05 Aug 1999 16:21:23 -0700
Message-ID: <37AA1C73.4F29625@rationalconcepts.com>


Hi Richard,
  @yourmachinename:1521:yourdbname

should work,
 e.g. @richardsbox:1521:richardsdb

That is of course if you set your db to listen on port 1521 (default).

Hope that helps, and I hope you have studied up on jdbc :-) Cindy

Richard Cuello 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
> ______________________________________________________________________
>
> //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();
> }
> }
> }
> }
Received on Thu Aug 05 1999 - 18:21:23 CDT

Original text of this message

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