Class.forname(class) is only to load the class. Nor for making a connection.
We need to use DriverManager for conenction.
 
 String url = "jdbc:oracle:oci8://server:port/DataBase"; // or thin
 String driver = "oracle.jdbc.driver.OracleDriver";
 
//Loding the Database driver
      Class.forName(driver);
//Connecting to the DB source 
      Connection con = DriverManager.getConnection(url,"username","passwd");
            
 
In some database settings
we need to change the url to
String url = "jdbc:oracle:oci8://server:port/DataBase;UID=username;PWD=passwd@tnsname_mapping";
Harish
----- Original Message -----
Sent: Saturday, April 06, 2002 1:54 AM
Subject: Re: JDBC with oracle

Using DriverManager should not be used in a multi-server environment; use
 
Class.forName(xxx);
Thread.currentThread().getContextClassLoader().loadClass( xxx);
 
instead.
 
Mark
-----Original Message-----
From: Dahnke, Eric [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 12:14 PM
To: [EMAIL PROTECTED]
Subject: Re: JDBC with oracle

1. the drivers come with your oracle installation. on my windoze box they are here: /oracle/ora81/jdbc/lib/classes12.zip.
2. put the classes12.jar file in your classpath. use a connection string as follows in your code (Connection Conn = DriverManager.getConnection "jdbc:oracle:thin:@10.1.1.15:1521:nxtdb","NXTDB01","passwd!"
 
 
-----Original Message-----
From: tejas patel [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 12:08 PM
To: [EMAIL PROTECTED]
Subject: JDBC with oracle

hello all,

I need some help regarding JDBC. At present I am using MSAccess as a database and sun.jdbc.odbc.JdbcOdbcDriver driver. We are migrating to Oracle database. now I need to change my servlet's code in order to work with oracle database

My questions are

1. where can I download oracle.jdbc.driver.OracleDriver

2. What I need to configure in order to connect to oracle database. Do i need to change my classpath or I need to download addition library's.

Thanks

Tejas



Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax

Reply via email to