| Author |
Could not load driver: oracle.jdbc.driver. OracleDriver problem
|
Hu Li
Greenhorn
Joined: Sep 08, 2004
Posts: 3
|
|
Hi all, I got a problem that I can not solve for a few days. I created a simple Java class to test connection to an Oracle database. It worked fine as the code returned a 'connection successful' message. I then zipped up the file and save it on a disk. However when I unzipped the file and tried to run it with a Windows batch file I got the dreaded message 'Could not load driver: oracle.jdbc.driver.OracleDriver' .Below is the batch file: ********************************************************* set DEFAULT_HOME_HOME=. set JAVA_HOME=%DEFAULT_HOME_HOME%\JRE\1.3.1 set PATH=%JAVA_HOME%\bin;%PATH% set CLASSPATH=%JAVA_HOME%\lib\rt.jar;%JAVA_HOME%\lib\i18n.jar;%DEFAULT_HOME_HOME%\lib\classes12.zip;%DEFAULT_HOME_HOME%\lib java -jar testConn.jar pause ************************************************ I have checked and made sure all of the required files are in their proper directories. Let me know if you spot a problem...
|
 |
Julian Kennedy
Ranch Hand
Joined: Aug 02, 2004
Posts: 823
|
|
So, is the "could not load driver" message a polite version of a ClassNotFoundException? If that's the case then the JVM obviously can't find the driver class in your classpath. Is the driver in classes12.zip? You should really double-check. What's the idea of having ./lib on the classpath? Have you tried running with -classpath on the command line? Do you stil have your original before you put it on disk? Does that still work? If so have you tried to run a diff? Anyway, I hope this gives you some ideas but I can't see any obvious reason why it isn't working for you. Jules
|
 |
Hu Li
Greenhorn
Joined: Sep 08, 2004
Posts: 3
|
|
Julian, Thanks for the reply. Yes all files are in their proper directories. I have tried the following: 1) java -classpath java -classpath .;C:\classes12;C:\jbuilder9\jdk1.4\jre\lib\rt.jar;C:\jbuilder9\jdk1.4\jre\lib\i18n.jar;C:\jbuilder9\jdk1.4\jre\lib\sunrsasign.jar;C:\jbuilder9\jdk1.4\jre\lib\jsse.jar;C:\jbuilder9\jdk1.4\jre\lib\jce.jar;C:\jbuilder9\jdk1.4\jre\lib\charsets.jar;C:\jbuilder9\jdk1.4\jre\classes;C:\jbuilder9\jdk1.4\lib\tools.jar -jar testConn.jar In jbuilder, I see this when I tried to run the application C:\jbuilder9\jdk1.4\bin\javaw -classpath "D:\Documents and Settings\bwfxhhb\jbproject\TestConnection\classes;C:\classes12;C:\jbuilder9\jdk1.4\jre\lib\rt.jar;C:\jbuilder9\jdk1.4\jre\lib\i18n.jar;C:\jbuilder9\jdk1.4\jre\lib\sunrsasign.jar;C:\jbuilder9\jdk1.4\jre\lib\jsse.jar;C:\jbuilder9\jdk1.4\jre\lib\jce.jar;C:\jbuilder9\jdk1.4\jre\lib\charsets.jar;C:\jbuilder9\jdk1.4\jre\classes;C:\jbuilder9\jdk1.4\lib\tools.jar" com.****.test.ConnectionManager Load of driver successful: oracle.jdbc.driver.OracleDriver DBURL = jdbc racle:thin:@XXXXXXXX.com:1521 RSFMID1 Connection successful :jdbc racle:thin:@XXXXXXX.com:1521 RSFMID1 Do you see any problems?
|
 |
Hu Li
Greenhorn
Joined: Sep 08, 2004
Posts: 3
|
|
I finally got it to work I put the classes12.jar in java_home/jre/lib/ext as per the following forum http://forum.java.sun.com/thread.jsp?forum=48&thread=444320 Now the question is, why does it work?
|
 |
Prashant Jain
Greenhorn
Joined: Aug 19, 2004
Posts: 29
|
|
Hi I have encountered the same issue while working with WSAD.In the available JREs I gave the path of where i had installed JDK1.3, yet I had to put the classes12.zip in the ext. My guess is that when i run the program within WSAD, only /ext folder is searched.Perhaps Julian could clear the doubt for both of us. What do you say Julian? regards Prashant Jain
|
 |
 |
|
|
subject: Could not load driver: oracle.jdbc.driver. OracleDriver problem
|
|
|