Unable to connect to the oracle using jdbc thin
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Meer_Alam
Posted On:   Wednesday, March 26, 2003 11:47 PM

I am trying to connect to the oracle from a java standalong program using to following code: // Step 1: Load the JDBC driver. //Method 1 DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); //Method2, Alternative //Class.forName("oracle.jdbc.OracleDriver"); // Step 2: Establish the connection to the database. String url = "jdbc:oracle:thin:@localhost:1521: "; Connection conn = DriverManager.getConnection(url,"scott","tiger"); Now it appears to me that after excution, the Driver gets loaded (both registerDriver and forName works), but the connection is not est   More>>

I am trying to connect to the oracle from a java standalong program using to following code:

			

// Step 1: Load the JDBC driver.

//Method 1

DriverManager.registerDriver(new oracle.jdbc.OracleDriver());

//Method2, Alternative

//Class.forName("oracle.jdbc.OracleDriver");


// Step 2: Establish the connection to the database.

String url = "jdbc:oracle:thin:@localhost:1521: ";

Connection conn = DriverManager.getConnection(url,"scott","tiger");






Now it appears to me that after excution, the Driver gets loaded (both registerDriver and forName works), but the connection is not established. I am getting error messages form the Connection part. It says no class definition found because of unknown source.

What am I doing wrong? Please help. I created a DSN entry with the service name and using the same service name. I can connect the server through SQL*PLUS. The DSN test says connection successful but programm is unable to connect at runtime.

Please please please help.

Meer Alam    <<Less

Re: Unable to connect to the oracle using jdbc thin

Posted By:   Christopher_Koenigsberg  
Posted On:   Thursday, March 27, 2003 06:38 AM

Make sure the "classes12" is on your CLASSPATH when your application is executing. You might have to rename "classes12.zip", to "classes12.jar", too (and put "classes12.jar" on the CLASSPATH).

About | Sitemap | Contact