This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Websphere and the fly likes WebSphere connection pool to DB2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "WebSphere connection pool to DB2" Watch "WebSphere connection pool to DB2" New topic
Author

WebSphere connection pool to DB2

Harish SK
Greenhorn

Joined: Jun 01, 2001
Posts: 20
I am getting the following exception while trying to access connection pool for DB2 (oracle datasource works) I am using the .....app.DB2Driver available in db2java.zip available when DB2 is installed. I inatalled the driver using Admin Console of DB2.
*** SQLException caught ***
java.sql.SQLException: Error loading JDBC driver: COM.ibm.db2.jdbc.app.DB2Driver
java.lang.Throwable(java.lang.String)
java.lang.Exception(java.lang.String)
java.sql.SQLException(java.lang.String)
java.sql.Driver com.ibm.ejs.cm.JDBCDataSource.loadAndCheckDriver()
com.ibm.ejs.cm.pool.ConnectionFactory com.ibm.ejs.cm.JDBCDataSource.createConnectionFactory()
javax.sql.DataSource com.ibm.ejs.cm.DataSourceImpl.getSource()
java.sql.Connection com.ibm.ejs.cm.DataSourceImpl.getConnection()
void DsTest.main(java.lang.String [])
Rahul Mahindrakar
Ranch Hand

Joined: Jul 28, 2000
Posts: 1850
Try not using the db2 driver provided with websphere and that provided with the DB2 client installation. There is a difference in the file sizes provided by these two.
Harish SK
Greenhorn

Joined: Jun 01, 2001
Posts: 20
Yes I had found that out was using db2java.zip from db2's directory. Problem is that the connection pool works from a servlet deployed in websphere but gives exception when I try to use connection pool from a client program in IBM Visual Age.
Can anybody help in this forum?
Rahul Mahindrakar
Ranch Hand

Joined: Jul 28, 2000
Posts: 1850
I dont understand this part

but gives exception when I try to use connection pool from a client program in IBM Visual Age.

Harish SK
Greenhorn

Joined: Jun 01, 2001
Posts: 20
When I execute a java program in IBM Visual Age IDE which uses connection pool in WebSphere and does pool.getConnection, following exception is thrown...
(Relevant features for websphere are installed in Visual-Age IDE)
java.sql.SQLException: Error loading JDBC driver: COM.ibm.db2.jdbc.app.DB2Driver
java.lang.Throwable(java.lang.String)
java.lang.Exception(java.lang.String)
java.sql.SQLException(java.lang.String)
java.sql.Driver com.ibm.ejs.cm.JDBCDataSource.loadAndCheckDriver()
com.ibm.ejs.cm.pool.ConnectionFactory com.ibm.ejs.cm.JDBCDataSource.createConnectionFactory()
javax.sql.DataSource com.ibm.ejs.cm.DataSourceImpl.getSource()
java.sql.Connection com.ibm.ejs.cm.DataSourceImpl.getConnection()
void DsTest.main(java.lang.String [])
Edward Singleton
Greenhorn

Joined: Jun 26, 2002
Posts: 4
I had this exact problem after successfully connecting to a DataSource on WebSphere from VisualAge for Java v3.5.3 for weeks. Other developers with the same setup had no problems. To resolve the problem I performed the following steps:
1. Close VisualAge if it is open.
2. Rename db2java.zip to something such as db2java.zip_ so VisualAge will no longer recognize it.
3. Open VisualAge.
4. Change db2java.zip back to its original name.
5. Start the WebSphere Test Environment.
This worked for me...good luck to you.
Roger Graff
Ranch Hand

Joined: May 29, 2001
Posts: 112
I am stuggling with this exact same issue! I can connect to DB2 if I create my own connection
(edit: note that the smiley face is not in my code!)

,but when I try to get a connection from DataSource

if get the same error:

I'm trying to connect from VAJ 4.0's WTE to DB2 7.2 on a remote host.
I have done the following:
  • ran usejdbc2.bat
  • replaced db2java.zip with the version that comes with DB2
  • added <pathname>\db2java.zip to my classpath via windows
  • added <pathname>\db2java.zip to my classpath via WTE Servlet Engine "edit classpath" button
  • shutdown VAJ, rename db2java.zip to db2java.zip_ , etc. (per previous post)
  • installed DB2 Client on machine that VAJ resides on
  • rebooted my machine

  • I'm running out of ideas!
    Anyone have any other suggestions?!
    [ June 28, 2002: Message edited by: Roger Graff ]
    [ June 28, 2002: Message edited by: Roger Graff ]
  • Edward Singleton
    Greenhorn

    Joined: Jun 26, 2002
    Posts: 4
    Sorry folks. I had fixed this problem previously using the steps I provided in a previous post, but the problem has returned and I cannot seem fix it. I am considering reinstalling VisualAge because no one else in my shop is experiencing this problem - and my machine is set up the same as theirs.
    Any other ideas???
    Roger Graff
    Ranch Hand

    Joined: May 29, 2001
    Posts: 112
    Ed - that is strange that your VAJ reverts back to its bad habits after a period of time. I don't have a solution, but I'll take a stab at what's happening to you.
    Perhaps VAJ looks at an internal variable to determine the location of the driver. If that variable isn't set, it looks at some environment variable for the driver location and sets the internal variable accordingly. Now let's assume that the value of the environment variable is wrong.
    Next, WTE is fired up. WTE looks at the same internal variable for the driver location. If the internal variable has not been set, WTE looks at a different (correct)environment variable and sets the internal variable.
    If all these assumptions are correct, it would explain why the steps you took to correct the problem worked. Since VAJ couldn't see db2java.zip, it did not set the value of the internal variable. Now when WTE sees that the value of the internal variable was not set, it does its own look up and (now since you re-named the filed back to db2java.zip), it correctly sets the value of the internal variable.
    Are you guys buying this so far?
    Next, fast forward in time a few days/weeks/whatever. Something wacky happens inside VAJ/WTE that causes the value of the internal variable to be set to null. Now the process happens all over again!
    If this is what is actually happening, the question is why is VAJ looking in the wrong place for the value of db2java.zip??? Perhaps you have correctly set the classpath in WTE, but NOT set it in VAJ!
    So Ed, have you set your classpath in both Windows/system -> advanced tab ->set environment variables? How about in WTE/Servlet engine -> set environment variables? Is there another place in VAJ (not WTE) that you need to set the classpath?
    Roger Graff
    Ranch Hand

    Joined: May 29, 2001
    Posts: 112
    Regarding my problem:
    I find it very strange that if I manually create a connetion, WTE can see db2java.zip but if I use the DataSource, WTE cannot see db2java.zip.
    I guess that means I have not correctly configured my DataSource (both in the code and in the Persistant Naming Server). Anyone care to eyeball my code (see previous posts) to determine if I'm doing something wrong there?
    Roger Graff
    Ranch Hand

    Joined: May 29, 2001
    Posts: 112
    Still fighting WTE on this. I've pointed the following classpaths to <local DB2 client directory>\SQLLIB\java\db2java.zip (1330 kb):
    Windows environment classpath
    Servlet engine classpath
    VAJ workspace classpath (window->options->resources)
    Is there a way to explicitly set the classpath for the Persisent Name Server?
     
    Don't get me started about those stupid light bulbs.
     
    subject: WebSphere connection pool to DB2