By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,611 Members | 1,711 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,611 IT Pros & Developers. It's quick & easy.

Tomcat and DB2

P: n/a
I am trying to get connection pooling working with Tomcat 5.5 and DB2
v8.1. This was working under Websphere Studio Application Developer
5.x but we are trying to move onto Eclipse and Tomcat.

The datasources seem to get created correctly but I get an error when I
try to get the connection from the datasource:

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
driver of class 'COM.ibm.db2.jdbc.app.DB2Driver' for connect URL
'jdbc:db2:mlmstrd1'
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.create DataSource(BasicDataSource.java:780)
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getCon nection(BasicDataSource.java:554)

Caused by: java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.jav a:243)
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.create DataSource(BasicDataSource.java:773)
... 26 more
I've tried renaming the db2java.zip to db2java.jar and moving it to
common\lib. No matter what I try I get the same error.

Any help that anyone can give would be greatly appreciated.

Thanks,

Jon

Nov 12 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
Hi Jon;
I had similar issues. I finally punted and put db2java.jar and
db2jcc.jar in both common\lib and the webapp's WEB-INF\lib directories.
Probably shouldn't need to do it, but it has corrected my problems.

Pete H

Nov 12 '05 #2

P: n/a
In article <11**********************@g44g2000cwa.googlegroups .com>,
(br****@gmail.com) says...
I am trying to get connection pooling working with Tomcat 5.5 and DB2
v8.1. This was working under Websphere Studio Application Developer
5.x but we are trying to move onto Eclipse and Tomcat.


The 'Database Web Server Software Installation Guide' at
http://tinyurl.com/8ekov might be able to help you.
Nov 12 '05 #3

P: n/a
I tried that as well. Still get the same error.

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
driver of class 'COM.ibm.db2.jdbc.app.DB2Driver' for connect URL
'jdbc:db2:bfstest'

Nov 12 '05 #4

P: n/a
For starters you must confirm that you can connect to DB2 from the
command line.

You may have to add a node for the bfstest database to the DB2 catalog.

Incase you're new to db2 the syntax is something like ...

For bfstesti is as the db2 instance,
and bfstest as the database,
and the server is mydb2server,
running on port 9100
db2 catalog tcpip node bfstesti remote mydb2server server 9100
db2 catalog db bfstest as bfstest at node bfstesti
br****@gmail.com wrote:
I tried that as well. Still get the same error.

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
driver of class 'COM.ibm.db2.jdbc.app.DB2Driver' for connect URL
'jdbc:db2:bfstest'


Nov 12 '05 #5

P: n/a
Given the error:
Cannot create JDBC driver of class 'COM.ibm.db2.jdbc.app.DB2Driver' for
connect URL
'jdbc:db2:bfstest'

This error has nothing to do with the database itself. You aren't even
getting that far yet. This error is telling you that java is unable to find
the ".app" driver. That driver exists in the "db2java.zip" file. Make sure
that that file exists (usually in "sqllib/java" directory) and that it is in
the CLASSPATH in the environment in which the app runs.

--
--------------------
Larry Menard
"Defender of Geese and of All Things Natural"
<gi*******************@yahoo.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com... For starters you must confirm that you can connect to DB2 from the
command line.

You may have to add a node for the bfstest database to the DB2 catalog.

Incase you're new to db2 the syntax is something like ...

For bfstesti is as the db2 instance,
and bfstest as the database,
and the server is mydb2server,
running on port 9100
db2 catalog tcpip node bfstesti remote mydb2server server 9100
db2 catalog db bfstest as bfstest at node bfstesti
br****@gmail.com wrote:
I tried that as well. Still get the same error.

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
driver of class 'COM.ibm.db2.jdbc.app.DB2Driver' for connect URL
'jdbc:db2:bfstest'

Nov 12 '05 #6

P: n/a
I have copied the db2java.zip file into tomcat_home\common\lib and
tried it with .zip and .jar extensions. Neither have worked. I've
added the path to the file to the classpath in the Configure Tomcat
app.

Nov 12 '05 #7

P: n/a
Well, I can't tell you offhand why that didn't seem to help, but I am
quite confident that that is what the error means.

Make sure that the string you add to your CLASSPATH includes the file
name, not just the directory. E.g.,
"C:\PROGRA~1\IBM\SQLLIB\java\db2java.zip", not just
"C:\PROGRA~1\IBM\SQLLIB\java".

--
--------------------
Larry Menard
"Defender of Geese and of All Things Natural"
<br****@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have copied the db2java.zip file into tomcat_home\common\lib and
tried it with .zip and .jar extensions. Neither have worked. I've
added the path to the file to the classpath in the Configure Tomcat
app.

Nov 12 '05 #8

P: n/a
In article <11**********************@f14g2000cwb.googlegroups .com>,
br****@gmail.com (br****@gmail.com) says...
I have copied the db2java.zip file into tomcat_home\common\lib and
tried it with .zip and .jar extensions. Neither have worked. I've
added the path to the file to the classpath in the Configure Tomcat
app.


Try unzipping the db2java.zip into tomcat_home\common\classes
It worked for me (credits to the sysinternals filemon tool).
Nov 12 '05 #9

P: n/a
I thought that would have worked but unfortunately I am still getting
the same error.

Nov 12 '05 #10

P: n/a
In article <11*********************@g14g2000cwa.googlegroups. com>,
br****@gmail.com (br****@gmail.com) says...
I thought that would have worked but unfortunately I am still getting
the same error.


Try to find out in which folder Tomcat is searching for the DB2
driver by starting filemon (download from
http://www.sysinternals.com/Utilities/Filemon.html and set the filter
on *tomcat*).
Nov 12 '05 #11

P: n/a
Thank you for that suggestion. The file monitor shows that it does
access tomcat_home\common\lib\db2java.jar. Now I am beginning to
think that I might need a new driver. Will let you know what I can
find.

Thanks again.

Jon
Gert van der Kooij wrote:
In article <11*********************@g14g2000cwa.googlegroups. com>,
br****@gmail.com (br****@gmail.com) says...
I thought that would have worked but unfortunately I am still getting
the same error.


Try to find out in which folder Tomcat is searching for the DB2
driver by starting filemon (download from
http://www.sysinternals.com/Utilities/Filemon.html and set the filter
on *tomcat*).


Nov 12 '05 #12

P: n/a
Tim
I would strongly suggest that you take a look at the DB2 JCC driver
too. This is a type 4 driver and doesn't require a DB2 client
installed on the server that's running the Java app and all that's
required to make a connection to a database is a URL, user name and
password.

There are two files that you'll need, db2jcc.jar and one of
db2jcc_license_cisuz.jar or db2jcc_license_cu.jar. In our case we
unjarred the jcc and license jar's and jarred them up again so we only
need to deploy one file. Making updates to the driver on the
application side is dead easy since you only need to drop in a new jar
file.

regards
tim

Nov 12 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.