aspose file tools*
The moose likes JDBC and the fly likes JDBC and Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC and Tomcat" Watch "JDBC and Tomcat" New topic
Author

JDBC and Tomcat

Bob Kimmel
Greenhorn

Joined: Aug 27, 2003
Posts: 26
Hi,
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:
Class.forName("oracle.jdbc.driver.OracleDriver");
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.
Thanks,
Bob
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
Rancher

Joined: Mar 06, 2001
Posts: 13459

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

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,
Bob
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC and Tomcat