tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Tomcat 6 not working with JDBC driver for MySQL
Date Wed, 27 Jul 2011 22:38:49 GMT
Hash: SHA1

To whom it may concern,

On 7/25/2011 4:40 PM, A Df wrote:
> I have added the MySQL Connector/J JDBC Driver to the
> $CATALINA_HOME/lib directory


> I have modify the web application deployment descriptor
> (/WEB-INF/web.xml)
> <resource-ref> <res-ref-name> jdbc/myDB </res-ref-name> <res-type>

> javax.sql.DataSource </res-type> <res-auth> Container </res-auth> 
> </resource-ref>


> I have modified the XML file (META-INF/context.xml) found in the
> project’s folders <Context crossContext="true" debug="5"
> docBase="TweetCollector" antiJARLocking="true"
> path="/TweetCollector" reloadable="true">

Okay, the following attributes should not be used:

- - debug (ignored)
- - docBase (context.xml is already in a WAR/WARdir)
- - path (Tomcat determines the deployment path from the WAR/WARdir name)

> <Resource name="jdbc/myDB" auth="Container" 
> type="javax.sql.DataSource" username="root" password="administrator" 
> driverClassName="com.mysql.jdbc.Driver" 
> url="jdbc:mysql://localhost:3306/myDB?autoReconnect=true" 
> maxActive="8" maxIdle="4"/>

That looks good to me.

> The connection in the log prints as 
> jdbc:mysql://localhost:3306/myDB?autoReconnect=true,
> UserName=root@localhost, MySQL-AB JDBC Driver

What connection in what log?

> However, it gives the error: 
> org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
> driver OR java.sql.SQLException: No suitable driver

Do you have JDBS drivers in multiple places?

Try stopping Tomcat, deleting the whole "work" directory and any cached
deployment descriptors under conf/Catalina/localhost/[webapp].xml

> Is it that the version for the server needs to match specific
> version for MySQL and its driver?


> How can I solve the JDBC issue? I have tried so many posts and made 
> so many changes that i am really frustrated and dont know what else 
> to do. Thanks.

Historically, that message ("No suitable driver") means that your
configuration is slightly wrong. Since Tomcat caches the deployment
descriptor, yours might be out-of-date, hence my suggestions above.

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message