tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Tomcat 6 not working with JDBC driver for MySQL
Date Wed, 27 Jul 2011 22:38:49 GMT
-----BEGIN PGP SIGNED MESSAGE-----
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

Good.

> 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>

Okay.

> 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?

No.

> 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk4wk3kACgkQ9CaO5/Lv0PB7kgCfS2nlgOkLMkQX5COyzXviIXW1
oFwAoKe2K0ceu6Vw+XiMpGCORYD55x3u
=IqxP
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message