Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC and Tomcat

 
Bob Kimmel
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic