I am getting the above exception, and I don't know why. Here is some more information:
Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL 'jdbc:mysql://localhost:3306/staffing_2014'
I am using Spring. In the Spring application context, I have the following dataSource:
<jee:jndi-lookup id="dataSource"
jndi-name="jdbc/StaffingDB"
expected-type="javax.sql.DataSource" />
It seems to read the database URL and credentials OK from tomcat's context.xml
:
<Resource name="jdbc/StaffingDB" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="xxx" password="yyy" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/staffing_2014"/>
Before anyone suggests Googling it, I have. The obvious answers I've found have been:
- Database URL malformed? - checked and OK.
- MySQL driver in classpath? Yes- jar is in
$TOMCAT_HOME/lib
Any other suggesions?
EDIT - way down the bottom:
java.sql.SQLException: No suitable driver
java.sql.DriverManager.getDriver(DriverManager.java:279)
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)