• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

WebSphere connection pool to DB2

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 [])
 
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 [])
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
    Posts: 4
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 112
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 112
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 112
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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?
    reply
      Bookmark Topic Watch Topic
    • New Topic