This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JDBC and the fly likes java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver" Watch "java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver" New topic
Author

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

Kee Kee moon
Ranch Hand

Joined: Dec 11, 2009
Posts: 140
I have classes12.jar in C:\oracle\product\10.2.0\db_1\jdbc\lib\ and the classes12.jar does contain OracleDriver.class please see below. I have set the classpath environment to
C:\oracle\product\10.2.0\db_1\jdbc\lib\. But I still get an error as java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

C:\jar tvf C:\oracle\product\10.2.0\db_1\jdbc\lib\classes12.jar oracle/jdbc/driver/OracleDriver.class
13666 Wed Jun 22 11:16:02 EDT 2005 oracle/jdbc/driver/OracleDriver.class


Please help.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2350

Can you try to set your classpath to C:\oracle\product\10.2.0\db_1\jdbc\lib\<jdbc jar file>?

Also, check if you are using the correct jar file for your platform:
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_10201.html
classes12.jar is for use with JDK 1.2 and JDK 1.3


OCUP UML fundamental
ITIL foundation
Kee Kee moon
Ranch Hand

Joined: Dec 11, 2009
Posts: 140
Jan Cumps wrote:Can you try to set your classpath to C:\oracle\product\10.2.0\db_1\jdbc\lib\<jdbc jar file>?

Also, check if you are using the correct jar file for your platform:
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_10201.html
classes12.jar is for use with JDK 1.2 and JDK 1.3



I have download the classes12.jar from the path you provide, but still failed.

I checked my java version by issuing a command as below and it returned java version "1.6.0_18"
java -version
java version "1.6.0_18"

Should I still use oracle.jdbc.driver.OracleDriver.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2350

Have you followed my other advise: "Can you try to set your classpath to C:\oracle\product\10.2.0\db_1\jdbc\lib\<jdbc jar file>" ?

And classes12.jar is not the right jar for Oracle 10.2 with Java 1.6 (classes12.jar is for use with JDK 1.2 and JDK 1.3 ).
Kee Kee moon
Ranch Hand

Joined: Dec 11, 2009
Posts: 140
Jan Cumps wrote:Have you followed my other advise: "Can you try to set your classpath to C:\oracle\product\10.2.0\db_1\jdbc\lib\<jdbc jar file>" ?

And classes12.jar is not the right jar for Oracle 10.2 with Java 1.6 (classes12.jar is for use with JDK 1.2 and JDK 1.3 ).


I found something and it is interesting, see below:

jar tvf C:\oracle\product\10.2.0\db_1\jdbc\lib\classes12.jar oracle\jdbc\driver\OracleDriver.class <<== with backslash it does not return anything.

jar tvf C:\oracle\product\10.2.0\db_1\jdbc\lib\classes12.jar oracle/jdbc/driver/OracleDriver.class <<== it does return the OracleDriver.class
13666 Wed Jun 22 18:50:02 EDT 2005 oracle/jdbc/driver/OracleDriver.class
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2350

That behavior is as expected and as documented.

But back to the original subject: does your code work if you add the correct jdbc .jar to your classpath, in stead of the folder where the jdbc jars are located?
Kee Kee moon
Ranch Hand

Joined: Dec 11, 2009
Posts: 140
Kee Kee moon wrote:
Jan Cumps wrote:Have you followed my other advise: "Can you try to set your classpath to C:\oracle\product\10.2.0\db_1\jdbc\lib\<jdbc jar file>" ?

And classes12.jar is not the right jar for Oracle 10.2 with Java 1.6 (classes12.jar is for use with JDK 1.2 and JDK 1.3 ).


I found something and it is interesting, see below:

jar tvf C:\oracle\product\10.2.0\db_1\jdbc\lib\classes12.jar oracle\jdbc\driver\OracleDriver.class <<== with backslash it does not return anything.

jar tvf C:\oracle\product\10.2.0\db_1\jdbc\lib\classes12.jar oracle/jdbc/driver/OracleDriver.class <<== it does return the OracleDriver.class
13666 Wed Jun 22 18:50:02 EDT 2005 oracle/jdbc/driver/OracleDriver.class



I have found the solution; I have resolved my problem. I add ojdbc14.jar into my configure path on my java application. Thanks for every who were trying to help me.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2350

Cool. Thank you for posting your solution.

Regards, Jan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
 
Similar Threads
Installed Oracle 10g in my Local system and now I am having problem connecting to it
package oracle.jdbc.driver does not exist
java.sql.SQLException: No suitable driver
java.lang.ClassNotFoundException: oracle:jdbc:driver:OracleDriver
How to add ojdbc.jar to my classpath?