my dog learned polymorphism*
The moose likes JDBC and the fly likes Cannot load JDBC driver class HELP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Cannot load JDBC driver class HELP" Watch "Cannot load JDBC driver class HELP" New topic
Author

Cannot load JDBC driver class HELP

Adam Teg
Ranch Hand

Joined: Feb 09, 2006
Posts: 36
Hi,
I am getting error: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'

my classpath is set as C:\tomcat\common\lib\mysql-connector-java-3.1.12 which is where the com.mysql.jdbc.driver is located.

I think the problem is in my servlet.xml below:
<Resource auth="Container"description="DB Connection" name="jdbc/TestDB"
type="javax.sql.DataSource" />
<ResourceParams name="jdbc/TestDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost/etest?autoReconnect=true</value>
</parameter>
<parameter>
<name>password</name>
<value>admin</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
http://dev.mysql.com/doc/refman/5.1/en/cj-tomcat-config.html
ajeesh_online
Greenhorn

Joined: Apr 30, 2006
Posts: 9
hello friend,

The same occured to me.
I think it is due to the absence of the package "com", But I am not sure
Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
Originally posted by Ajeesh M:
hello friend,

The same occured to me.
I think it is due to the absence of the package "com", But I am not sure


The first thing you always check when you have a class loading problem is your classpath. Your classpath is configured incorrectly.

Consult the documentation for your deployment environment to see how to correctly set (or add) your classpath to include the driver files.
 
Don't get me started about those stupid light bulbs.
 
subject: Cannot load JDBC driver class HELP
 
Similar Threads
Context in Virtual Hosts
Configuring a MySQL DataSource in Tomcat5
Datasource
problem in getting sybase Datasource in Tomcat 4.1.12
Datasource for Tomcat 4.1 and Sybase