Hi Martin,

My MySQL server is alive and well; I can connect to it using the same parameters, using a JDBC-based database browser. I didn't know about autoReconnect being deprecated; it still appears to be supported, but I see that the MySQL 5.0 reference manual recommends cranking up the server's wait_timeout instead. I'll do that and get rid of the autoReconnect; I don't want the server to ever drop idle connections anyway. Unfortunately, this doesn't fix the problem of the DataSource not getting initialized... but thanks anyway! :-)

- Thomas

[EMAIL PROTECTED] wrote:
Hi Tom

here is my jdbc.properties which is used for petstore access to MySQL tables
#jdbc.driverClassName=org.hsqldb.jdbcDriver
jdbc.driverClassName=com.mysql.jdbc.Driver
#jdbc.url=jdbc:hsqldb:hsql://localhost:9001
jdbc.url=jdbc:mysql://localhost:3306/petclinic
jdbc.username=fu
jdbc.password=bar

your URL is quite similar and constructed correctly
url="jdbc:mysql://ss-1.research.att.com:3306/wmmdev?autoReconnect=true"/

so I would check to see if there is a MySQL Listening on
ss1-.research.att.com e.g.
login to ss-1.research.att.com
netstat -a | grep 3306

the newer versions of mySQL (specifically 4 and 5) dont support deprecated
autoReconnect attribute
http://forums.mysql.com/read.php?39,32231,32231

HTH
Martin-
----- Original Message -----
Wrom: UZXUWLSZLKBRNVWWCUFPEGAUTFJMVRESKPN
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Friday, December 07, 2007 12:14 PM
Subject: DataSource created but not initialized => Cannot create JDBC driver
of class '' for connect URL 'null'


Hi all,

I'm trying to set up a DataSource to manage connections to a MySQL
database, but whenever I call getConnection(), I get this error:

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver
of class '' for connect URL 'null'
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource
java:1150)
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
va:880)
...
Caused by: java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:243)
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource
java:1143)
...


The datasource is defined in a file called
$TOMCAT_HOME/conf/Catalina/localhost/smm.xml (the web app's context path
is /smm); it looks like this:

<Context path="/smm" docBase="smm" debug="5" reloadable="true"
crossContext="true">
    <Resource name="jdbc/SmmDB" auth="Container"
type="javax.sql.DataSource"
                maxActive="100" maxIdle="30" maxWait="10000"
                username="wmmdev" password="wmmdev"
driverClassName="com.mysql.jdbc.Driver"

url="jdbc:mysql://ss-1.research.att.com:3306/wmmdev?autoReconnect=true"/>
</Context>

The fact that the datasource gets created and bound in JNDI tells me
that smm.xml is getting read, but apparently it is not getting
initialized properly; getDriverClassName(), getUrl(), getUsername(), and
getPassword() all return null, and it looks like that's what causes the
exception in getConnection().
I've seen quite a few questions about this error, but in the archived
threads on this mailing list, I haven't found any solution to this
particular problem... One poster who had the same diagnosis mentioned
that the problem went away when he got rid of the Context element in
META-INF/context.xml, but in my case, that file does not exist; in fact,
the only Context elements I have are the one shown above, and the
standard one in $TOMCAT_HOME/conf/context.xml.
The MySQL JDBC driver is in $TOMCAT_HOME/lib, and when I do
Class.forName("com.mysql.jdbc.Driver") in a JSP, it succeeds, but I'm
not sure that's relevant because, first of all, DriverManager will only
use drivers that were loaded by the same class loader as itself, and
second, the DataSource can't use the driver anyway as long as its
driverClassName and url properties remain unset.

I'm using Tomcat 6.0.14, JDK 1.5.0_11, MySQL 5.0.45, and
mysql-connector-java-5.1.5-bin.jar.

I'm stumped... Any thoughts would be much appreciated!

 - Thomas

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to