Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

jdbc driver in Java Servlet/Tomcat doesn't load

Status
Not open for further replies.

mydavor

Programmer
Joined
Mar 21, 2004
Messages
41
Location
AU
The piece of code loading oracle.jdbc.driver.OracleDriver succeedes in JAVAApi but not within a Servlet over Tomcat:

System.out.println("Loading the driver");
Class.forName("oracle.jdbc.driver.OracleDriver");
// Getting the connection
System.out.println("Getting the connection to demo@demo");

When called from a servlet it generates an exception:
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

The other prints: Getting the connection to demo@demo
Both programs have
import java.sql.*
use same CLASSPATH set in ControlPanel
run on the same box

Can you help ?
 
My servlet is stored in the following folder
I:\tom\webapps\servlet2\WEB-INF\classes
My mysql-connector-java-3.0.9-stable-bin.jar is stored in
I:\tom\webapps\servlet2\WEB-INF\lib
Java application needs classpath.
Tomcat needs classpath and jar file in the lib directory for your driver connecting to the database
 
Add classes12.jar (NOT classes12.zip) to TOMCAT_HOME/common/lib
 
Thanks, it worked out
 
Good... its something to bear in mind - that tomcat5 will not load .zip files like tomcat4 would.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top