tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Williams" <>
Subject Re: tomcat+j2sdk+mysql-connecto+mysql
Date Tue, 02 Sep 2003 10:14:45 GMT
Try to isolate the problem.  Check that you can get a Connection object by
doing something like the following:

String driver = ...;
String url = ...;
String userName = ...;
String pw = ...;
Connection conn = null;

try {
    conn = DriverManager.getConnection(url, userName, pw);
} catch (Exception e) {

// Do something with conn...
if (null != conn) {
    try {
    } catch (Exception e) {}
    conn = null;

This will enable you to isolate where your problem lies.  If you can get a
Connection object then your database and JDBC driver are set up correctly,
you have the correct URL for the data source, you have a valid user name and
password and the problem lies with the Wrox ConnectionPool class.  Otherwise
some element of your database setup is incorrect.

Check that you are referencing the driver class correctly.  When I need to
talk to MySQL I use the Connector /J driver available from the MySQL web

The name of the driver is:
Check that you have spelt it correctly.

Assume that you are accessing a MySQL database called "my_db" on localhost.
The URL to the datasource takes the form:
If MySQL is not listening on port 3306, you will need to change the port
value.  I leave user name and password to you - you can always use "root"
during development.

Chris Williams.

View raw message