*
The moose likes JDBC and the fly likes JDBC driver - java lang ClassNotFoundException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC driver - java lang ClassNotFoundException" Watch "JDBC driver - java lang ClassNotFoundException" New topic
Author

JDBC driver - java lang ClassNotFoundException

Avneet Singh
Ranch Hand

Joined: Apr 25, 2006
Posts: 51
Hi

I am tryin to make a connection to oracle database. when i do

Class.forName(oracle.jdbc.driver.OracleDriver);

I am getting

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

My CLASSPATH variable is set to C:\Program Files\Java\jdk1.5.0_06\jre\lib\classes111.zip and C:\Program Files\Java\jdk1.5.0_06\jre\lib\classes12.zip

I have evn set path for ORACLE_HOME/jdbc/lib/classes111.zip and ORACLE_HOME/jdbc/lib/classes12.zip.

but i am still gettin ClassNotFoundException.Most of the resources i have checked are talkinabout Path and classpath. I have checked them but i am pasting them below.

CLASSPATH =
C:\Program Files\Java\jdk1.5.0_06\jre\lib;C:\ProgramFiles\Java\jdk1.5.0_06\jre;C:\oracle\ora81\jdbc\lib\classes111.zip;C:\oracle\ora81\jdbc\lib\classes12.zip;C
:\Program Files\Java\jdk1.5.0_06\jre\lib\classes111.zip;C:\Program Files\Java\jdk1.5.0_06\jre\lib\classes12.zip;C:\Program Files\Java\jdk1.5.0_06\jre\lib\classe
s12.jar;C:\Program Files\Java\jdk1.5.0_06\jre\lib\classes111.jar;.

PATH =
c:\oracle\ora81\bin;C:\Program Files\Oracle\jre\1.1.7\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\IDM Computer Solutions\UltraEdit-32;C:\Program Files\Java\jdk1.5.0_06\bin;C:\oracle\ora81\bin;C:\oracle\ora81\lib;C:\Program Files\Java\jdk1.5.0_06\jre\lib\classes111.zip;C:\Program Files\Java\jd
k1.5.0_06\jre\lib\classes12.zip;.


Thanks in advance
Avneet
Avneet Singh
Ranch Hand

Joined: Apr 25, 2006
Posts: 51
and also i am using jdk 1.5.

Looking forward for help.Tried this patch on oracle site which asked for class file to be replaced in classes12.zip when we extract it at location
oracle/jdbc/ttc7 - didnt wotk , same error.

Now i hace switched back to the orignal classes12.zip
Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
Classpath variables are evil and as you can see have done you no good whatsoever.

The bottom line is that your runtime does not have the oracle libraries in it's classpath. You haven't identified how you are running this code.
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333



My CLASSPATH variable is set to C:\Program Files\Java\jdk1.5.0_06\jre\lib\classes111.zip and C:\Program Files\Java\jdk1.5.0_06\jre\lib\classes12.zip

I have evn set path for ORACLE_HOME/jdbc/lib/classes111.zip and ORACLE_HOME/jdbc/lib/classes12.zip.



While it has nothing to do with the ClassNotFoundException
1) classes111.zip is the driver for Java 1.1, classes12.zip is the driver for Java 1.2 You need to pick one or the other; having both will cause problems.
2) Generally, putting libraries in the jre\lib directory is wrong; they're part of your application and should be kept with your application code.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Originally posted by stu derby:
2) Generally, putting libraries in the jre\lib directory is wrong; they're part of your application and should be kept with your application code.
And in six months when you decide to download and start using JDK 1.5.0_08, all of a sudden you will have the same problem all over again.
Avneet Singh
Ranch Hand

Joined: Apr 25, 2006
Posts: 51
thanks guys for all your help, i pasted the class12.zip in the jre/lib/ext folder of jdk and then it worked.

This way it stays common for all my applications rather then keeping it with the code.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JDBC driver - java lang ClassNotFoundException
 
Similar Threads
Running Tomcat as service; JDBC not working now
Unsatisfied Link Error
WebLogic6.1/Oracle8.1.6 config problem (obvious to someone?)
Java, oracle on NT
problem with connection