tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Peterson <>
Subject Cannot load JDBC Driver class
Date Wed, 02 Apr 2003 10:28:16 GMT

I'm getting this java.sql.SQLException when trying to open a
on my datasource.  The WebSphere Test Environment datasource
opens connections fine,
but not Tomcat/4.1.24.  Other details, using DB2 Personal
Edition version 7.2,
on Windows 2000 Professional.

I copied C:\sqllib\ to $CATALINA_HOME/common/lib
directory, renaming
to db2java.jar.

I verified that the class was
actually in the jar file.

In the server.xml listing below I added parms for username
and password since I always see them in other postings, although
I have always spcified the username/password in the
method call, successfully in websphere.

  <Resource name="jdbc/GuppyDB" auth="Container"
  <ResourceParams name="jdbc/GuppyDB">
in web.xml:
    Resource reference to a factory for java.sql.Connection
    instances that may be used for talking to a particular
    database that is configured in the server.xml file.
in my servlet:

import java.sql.Connection;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource) envCtx.lookup("jdbc/GuppyDB");
Connection conn = ds.getConnection("user1", "passwd");

The following is thrown in the ds.getConnection method:

java.sql.SQLException: Cannot load JDBC driver class

Now I did see Fabio Mengue's posting from Feb 20 in a response
to someone asking a similar question.  I compared his config
with mine, added at the top of <TOMCAT>/bin/
the line
set JAVA_OPTS="-Djava.library.path=C:/Program

and started tomcat with the instead of the services
start in the Computer Management dialog.

The other item:
Add the following line
Create <TOMCAT>/bin/, as a copy (or a link) of file
I am at a loss, since I cannot find a db2profile file on my PC,
although I do have the DB2 server software installed as well as
DB2 client software.

If anyone has any helpful suggestions that would be welcome.

Stephen Peterson

Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more

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

View raw message