JDBC Driver Classpath

I am constantly getting the error that "Couldn't load database driver: oracle.jdbc.driver.OracleDriver "

Now I believe this is due to the fact that something is screwed up with my classpath. However I have the driver in my enviromental classpath and I believe that it needs to go in the classpath that my server is actually using to run my servlet. The problem is however that for some reason tomcat is installed in 2 different locations on my hard drive. c:\jakarta-tomcat-4.0-b5 and another place c:\program files\jtagdemo. Does anyone know why this is? I read in another post that the wrapper.properties file needs to be updated to make my driver work. However the only wrapper.properties file is located in the c:\program files\jtagdemo set of directories while I run Tomcat and my servlets/jsp pages through c:\jakarta-tomcat-4.0-b5.

How can I solve this error that I am getting? Much appreciation.

[931 byte] By [dUb] at [2007-9-26 2:03:11]
# 1

Having the driver archive in your environment classpath won't work. Like you said, it needs to be in the tomcat server's classpath. I'm not too familiar w/ tomcat 4b, but there should be a config file that has all the archives in it. Do a text search in all the tomcat directories for "servlet.jar". They may have changed over to an xml-style config file as apposed to a .properties file like in tomcat 3x.

-Derek

beattris at 2007-6-29 8:45:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Does anyone else know where this classpath can be changed at?
dUb at 2007-6-29 8:45:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Try putting Oracle JDBC driver jar/zip file in the subdirectory WEB-INF/lib of your web application.
neville_sequeira at 2007-6-29 8:45:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Thanks for the help beattris and neville_sequeira but unfortunately the web-inf/lib didn't solve the problem either.
dUb at 2007-6-29 8:45:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
try to put it in the %TOMCAT_HOME$/lib (you have to restart tomcat) if it's a jar file or try (if it's a zip) to unzip it in WEB-INF/classes
wobelix at 2007-6-29 8:45:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
wobelix you just made my day. Thank you so much for that info! Everything works perfectly now!
dUb at 2007-6-29 8:45:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

I think the reason is not where the jdbc class file is exists.

open the file %catalina_home%/bin/catalina.bat. about at rowno 70. you will see:

rem -- Set Up The Runtime Classpath -

set CP=%CATALINA_HOME%\bin\bootstrap.jar;%JAVA_HOME%\lib\tools.jar

if "%JSSE_HOME%" == "" goto noJsse

set CP=%CP%;%JSSE_HOME%\lib\jcert.jar;%JSSE_HOME%\lib\jnet.jar;%JSSE_HOME%\lib\jsse.jar

:noJsse

set CLASSPATH=%CP%

echo Using CATALINA_BASE: %CATALINA_BASE%

echo Using CATALINA_HOME: %CATALINA_HOME%

echo Using CLASSPATH:%CLASSPATH%

echo Using JAVA_HOME:%JAVA_HOME%

that means the catalina does not use the classpath of the os system, it makes one by itself. I am using oracle816, oracle jdbc class file is G:\orant\jdbc\lib\classes12.zip. so I change the catalina.bat file as this:

.....

rem -- Set Up The Runtime Classpath -

set CP=%CATALINA_HOME%\bin\bootstrap.jar;%JAVA_HOME%\lib\tools.jar;G:\orant\jdbc\lib\classes12.zip

if "%JSSE_HOME%" == "" goto noJsse

set CP=%CP%;%JSSE_HOME%\lib\jcert.jar;%JSSE_HOME%\lib\jnet.jar;%JSSE_HOME%\lib\jsse.jar

:noJsse

set CLASSPATH=%CP%

echo Using CATALINA_BASE: %CATALINA_BASE%

echo Using CATALINA_HOME: %CATALINA_HOME%

echo Using CLASSPATH:%CLASSPATH%

echo Using JAVA_HOME:%JAVA_HOME%

.....

then the tomcat can run properly. Is this right?

zhaoleiin at 2007-6-29 8:45:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
> then the tomcat can run properly. Is this right?> Yes. perfectly said.
sudha_mp at 2007-6-29 8:45:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...