• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot load JDBC driver class HELP  RSS feed

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
Ranch Hand
Posts: 333
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello friend,

The same occured to me.
I think it is due to the absence of the package "com", But I am not sure
 
Ranch Hand
Posts: 381
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!