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 SkipVought 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
Mar 21, 2004
41
0
0
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
 
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