Wrox Home  
Search P2P Archive for: Go

  Return to Index  

apache_tomcat thread: Loading the Oracle JDBC Driver


Message #1 by "Jon Pierson" <jon.pierson@E...> on Thu, 16 Jan 2003 19:30:31
I hope this is an easy one.

I am trying to use the Oracle JDBC driver from a servlet.

I copied the zip files provided by oracle to the C:\j2sdk1.4.0_02\lib 
folder

Then I added the following to my CLASSPATH:
;C:\j2sdk1.4.0_02\lib\classes111.zip;C:\j2sdk1.4.0_02\lib\classes12.zip

I load the class as follows:
try {
  Class.forName("oracle.jdbc.driver.OracleDriver");
}
catch(ClassNotFoundException e) {
  System.out.println("Couldn't load database driver: " + e.getMessage());
}

If I run this from the command line java interpreter it connects fine.
If I run it from a servlet it raises a ClassNotFoundException exception 
for oracle.jdbc.driver.OracleDriver.

Any help is greatly appreciated.

Jon Pierson
Entry Point Technologies, Inc
Message #2 by "Ben Galbraith" <junk@g...> on Fri, 17 Jan 2003 00:39:27
Hey Jon,

To use your Oracle classes with Tomcat web applications, just place the ZIP
files in the following location:

   [TOMCAT_HOME]/shared/lib

You may need to change the extension of the files to jar instead of zip,
but IIRC that might not be necessary.

Let me know how it goes,

Ben
Message #3 by "Jon Pierson" <jon.pierson@E...> on Fri, 17 Jan 2003 01:49:56
Hi Ben,

Thanks for your help.  I spent all day putting the zip files everywhere I 
could think of, browsing the web, reading books, and pulling my hair 
out.  It turns out it was as simple as renaming the files.  The files 
MUST BE RENAMED to .jar or they are ignored.  I saw this same problem 
posted about 20 different places without the right answer.  I hope people 
will find this thread in the future and save a few hairs.  Thanks again.

Jon

> Hey Jon,

> To use your Oracle classes with Tomcat web applications, just place the 
ZIP
f> iles in the following location:

>    [TOMCAT_HOME]/shared/lib

> You may need to change the extension of the files to jar instead of zip,
b> ut IIRC that might not be necessary.

> Let me know how it goes,

> Ben

  Return to Index