Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / October 2005

Tip: Looking for answers? Try searching our database.

Tomcat and DB2

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
brew82@gmail.com - 24 Oct 2005 20:38 GMT
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.createDataSource(BasicDataSource.java:780)
    at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:554)

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: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
peteh - 24 Oct 2005 21:03 GMT
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
brew82@gmail.com - 24 Oct 2005 22:11 GMT
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'
gimme_this_gimme_that@yahoo.com - 25 Oct 2005 01:59 GMT
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

> 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'
Larry Menard - 25 Oct 2005 03:27 GMT
  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.

Signature

--------------------
Larry Menard
"Defender of Geese and of All Things Natural"

> For starters you must confirm that you can connect to DB2 from the
> command line.
[quoted text clipped - 16 lines]
>> driver of class 'COM.ibm.db2.jdbc.app.DB2Driver' for connect URL
>> 'jdbc:db2:bfstest'
brew82@gmail.com - 25 Oct 2005 22:37 GMT
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.
Larry Menard - 26 Oct 2005 00:32 GMT
  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".

Signature

--------------------
Larry Menard
"Defender of Geese and of All Things Natural"

>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.
Gert van der Kooij - 26 Oct 2005 00:54 GMT
> 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).
brew82@gmail.com - 26 Oct 2005 02:42 GMT
I thought that would have worked but unfortunately I am still getting
the same error.
Gert van der Kooij - 26 Oct 2005 08:17 GMT
> 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*).
brew82@gmail.com - 26 Oct 2005 15:21 GMT
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

> > I thought that would have worked but unfortunately I am still getting
> > the same error.
[quoted text clipped - 3 lines]
> http://www.sysinternals.com/Utilities/Filemon.html and set the filter
> on *tomcat*).
Tim - 30 Oct 2005 16:54 GMT
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
Gert van der Kooij - 24 Oct 2005 21:10 GMT
> 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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.