File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes JDBC and Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC and Tomcat" Watch "JDBC and Tomcat" New topic

JDBC and Tomcat

Bob Kimmel

Joined: Aug 27, 2003
Posts: 26
I have a JSP that I was running under Weblogic that queries my Db and worked fine. This morning I tried loading Tomcat (it's free:-) and I moved all of my JSP and HTML to the ROOT dir. Now when I try to run the query I get 'ClassNotFoundException: oracle.jdbc.driver.OracleDriver'. I tried
putting it in the Class Path, even moved the drivers to the Tomcat Dir and added another Path.
Here is what my Connection in my JSP looks like:
conn = DriverManager.getConnection("jdbc racle:thin:@52796e:1521:ccevs","DB_owner","passwd");
The driver is located here C:\oracle\jdbc\driver and C:\jakarta-tomcat-4.1.27\oracle\jdbc\driver. Could be something really simple, I'm fairly new at all this.
Wayne L Johnson
Ranch Hand

Joined: Sep 03, 2003
Posts: 399
Try putting the drivers in C:\jakarta-tomcat-4.1.27\common\lib. Tomcat will automatically find any .jar file in that directory.
Alternatively you can put them in C:\jakarta-tomcat-4.1.27\webapps\<myapp>\WEB-INF\lib.
In the first case the .jar file will be available to EVERY web application. In the second case it will be available only to the one web application. Your choice, but either works.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

You may also need to change the extension to .jar if Oracle is still distributing its drivers as (it's been a while since i used Oracle). Tomcat will not typically open files other than jars.
Bob Kimmel

Joined: Aug 27, 2003
Posts: 26
What I think it is looking for is the OracleDriver.class which is location
in C:\oracle\jdbc\driver. (ClassNotFoundException: oracle.jdbc.driver.OracleDriver) If Tomcat can only open .jar files then this make sence. Can I change a .class to a .jar? Should I recreate the the complete dir structure starting a common (ex common\oracle\jdbc\driver)? Just looking for the best way. It worked fine in Weblogic. I'll keep playing with it until I get a reply.
Thanks again,
I agree. Here's the link:
subject: JDBC and Tomcat
jQuery in Action, 3rd edition