|
Home > Archive > WebSphere Application Server > May 2004 > Websphere 4.0 and connection pooling problem
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Websphere 4.0 and connection pooling problem
|
|
|
| I'm attempting to use a third party JDBC driver that supports the JDBC
2.0 connection pool datasource API (javax.sql.ConnectionPoolDataSource),
but I've been unable to get pooling working with Websphere 4.0. We can
create the datasource in the admin console using the JDBC Provider and
the "Test Connection" button makes a successful connection. Driver
traces and other info confirm that the datasource was successfully
instantiated, made a connection to DB2 and closed the connection,
however, attempting to acquire the datasource via JNDI results in a
ClassCastException for com.ibm.ejs.cm.JDBC1PhaseRef. I have no idea what
that is, but it's not the class name of the drivers
ConnectionPoolDataSource implementation.
Has anyone successfully used Websphere 4.0's connection pooling
mechanism with 3rd party DB2 drivers? If so could you provide details on
how to configure them?
TIA,
Bob
| |
| Ole Eirik Dalbye 2004-05-23, 7:29 am |
| Bob <removegandalf@removecal.net> wrote in message news:<20040522115330205-0700@news.cal.net>...
> I'm attempting to use a third party JDBC driver that supports the JDBC
> 2.0 connection pool datasource API (javax.sql.ConnectionPoolDataSource),
> but I've been unable to get pooling working with Websphere 4.0. We can
> create the datasource in the admin console using the JDBC Provider and
> the "Test Connection" button makes a successful connection. Driver
> traces and other info confirm that the datasource was successfully
> instantiated, made a connection to DB2 and closed the connection,
> however, attempting to acquire the datasource via JNDI results in a
> ClassCastException for com.ibm.ejs.cm.JDBC1PhaseRef. I have no idea what
> that is, but it's not the class name of the drivers
> ConnectionPoolDataSource implementation.
>
> Has anyone successfully used Websphere 4.0's connection pooling
> mechanism with 3rd party DB2 drivers? If so could you provide details on
> how to configure them?
>
> TIA,
>
> Bob
I was under the impression that your DB2 server had to be made ready
to accept the JDBC 2.0 API. The way you do that is stopping all the
DB2 services, go into your SQLIB/java12 folder and run the usejdbc2
file. Make sure you don't get any error messages becuase of running
services, then restart the DB2 services.
| |
| Ken Hygh 2004-05-23, 12:08 pm |
| Bob wrote:
> I'm attempting to use a third party JDBC driver that supports the JDBC
>2.0 connection pool datasource API (javax.sql.ConnectionPoolDataSource),
>but I've been unable to get pooling working with Websphere 4.0. We can
>create the datasource in the admin console using the JDBC Provider and
>the "Test Connection" button makes a successful connection. Driver
>traces and other info confirm that the datasource was successfully
>instantiated, made a connection to DB2 and closed the connection,
>however, attempting to acquire the datasource via JNDI results in a
>ClassCastException for com.ibm.ejs.cm.JDBC1PhaseRef. I have no idea what
>that is, but it's not the class name of the drivers
>ConnectionPoolDataSource implementation.
>
> Has anyone successfully used Websphere 4.0's connection pooling
>mechanism with 3rd party DB2 drivers? If so could you provide details on
>how to configure them?
>
>TIA,
>
>Bob
>
>
>
What's your code look like that gets the datasource? I've only used the
JDBC drivers delivered with DB2, so I can't help there.
Ken
| |
|
| Have at look at StarSQL for Java (www.starquest.com), it does support
connection pooling.
Bob <removegandalf@removecal.net> wrote in message news:<20040522115330205-0700@news.cal.net>...
> I'm attempting to use a third party JDBC driver that supports the JDBC
> 2.0 connection pool datasource API (javax.sql.ConnectionPoolDataSource),
> but I've been unable to get pooling working with Websphere 4.0. We can
> create the datasource in the admin console using the JDBC Provider and
> the "Test Connection" button makes a successful connection. Driver
> traces and other info confirm that the datasource was successfully
> instantiated, made a connection to DB2 and closed the connection,
> however, attempting to acquire the datasource via JNDI results in a
> ClassCastException for com.ibm.ejs.cm.JDBC1PhaseRef. I have no idea what
> that is, but it's not the class name of the drivers
> ConnectionPoolDataSource implementation.
>
> Has anyone successfully used Websphere 4.0's connection pooling
> mechanism with 3rd party DB2 drivers? If so could you provide details on
> how to configure them?
>
> TIA,
>
> Bob
| |
|
| In <a78ec628.0405230439.69fd0173@posting.google.com> DB2 wrote:
> Have at look at StarSQL for Java (www.starquest.com), it does support
> connection pooling.
>
> Bob <removegandalf@removecal.net> wrote in message news:
> <20040522115330205-0700@news.cal.net>...
>
That's what I'm using. I configured a datasource using the admin
console. The implementation class is com.starsql.datasource.
SQConnectionPoolDataSource and the JNDI name is jdbc/DB2V7S. In my app I
do:
ctx = new InitialContext();
ds = (ConnectionPoolDataSource)ctx.lookup("jdbc/DB2V7S");
The ClassCastException is occurring on the lookup() method call. Is
there anything else I need to configure (or modify) to get this working?
Bob
| |
| Manglu 2004-05-23, 11:29 pm |
| Bob,
You usually cast it to a javax.sql.DataSource Class not the
ConnectionPoolDataSource
I believe this ConnectionPoolDataSource is there since JDK1.4 while
WAS 4.0 lives on JDK 1.3
I havne't used ConnectionpoolDataSource but the usual cast from a JNDI
Data Source is
ds test = (DataSource) ctx.lookup("jdbc/value");
This is the case no matter whether you use DB2 JDBC Drivers or third
party drivers.
HTH
Manglu
| |
|
| In <2ae5cba9.0405231828.41cabef0@posting.google.com> Manglu wrote:
> Bob,
>
> You usually cast it to a javax.sql.DataSource Class not the
> ConnectionPoolDataSource
>
> I believe this ConnectionPoolDataSource is there since JDK1.4 while
> WAS 4.0 lives on JDK 1.3
>
>
> I havne't used ConnectionpoolDataSource but the usual cast from a JNDI
> Data Source is
>
> ds test = (DataSource) ctx.lookup("jdbc/value");
>
> This is the case no matter whether you use DB2 JDBC Drivers or third
> party drivers.
>
> HTH
> Manglu
>
That's incorrect on two counts. The datasource retrieved via the JNDI
lookup must be cast to javax.sql.ConnectionPoolDataSource in order to
call the method getPooledConnection(), which is the method used to
retrieve a Connection from a ConnectionPoolDataSource. The parent class
javax.sql.Datasource has no such method.
Secondly, the javax.sql.ConnectionPoolDataSource was introduced
originally in the JDBC 2.0 extensions (jdbc2_0-stdext.jar) which are
compatible with jdk 1.3.
| |
| Manglu 2004-05-24, 11:30 pm |
| Bob,
I am willing to be corrected.
But this is what i see from the docs
http://java.sun.com/j2se/1.4.2/docs...DataSource.html
The URL above states it is from
Since:
1.4
so i inferred that this available since JDK 1.4
http://java.sun.com/j2se/1.4.2/docs...Connection.html
which is returned on a getPooledConnection states that:
<snip>
An object that provides hooks for connection pool management. A
PooledConnection object represents a physical connection to a data
source. The connection can be recycled rather than being closed when
an application is finished with it, thus reducing the number of
connections that need to be made.
An application programmer does not use the PooledConnection interface
directly; rather, it is used by a middle tier infrastructure that
manages the pooling of connections.
When an application calls the method DataSource.getConnection, it gets
back a Connection object. If connection pooling is being done, that
Connection object is actually a handle to a PooledConnection object,
which is a physical connection.
</snip>
Notice that the doc indicates that we as Application programmers donot
use the PooledConnection and the application uses it indirectly via
the DataSource.getConnection.
Hope this makes things clearer.
Manglu
| |
|
| And so am I;-) You were absolutely correct the first time. My apologies.
In <2ae5cba9.0405241813.52dc1dcd@posting.google.com> Manglu wrote:
> Bob,
>
> I am willing to be corrected.
>
> But this is what i see from the docs
>
> http://java.sun.com/j2se/1.4.2/docs/api/javax/sql/
> ConnectionPoolDataSource.html
>
> The URL above states it is from
> Since:
> 1.4
>
> so i inferred that this available since JDK 1.4
>
> http://java.sun.com/j2se/1.4.2/docs...oledConnection.
> html
>
> which is returned on a getPooledConnection states that:
>
> <snip>
> An object that provides hooks for connection pool management. A
> PooledConnection object represents a physical connection to a data
> source. The connection can be recycled rather than being closed when
> an application is finished with it, thus reducing the number of
> connections that need to be made.
>
> An application programmer does not use the PooledConnection interface
> directly; rather, it is used by a middle tier infrastructure that
> manages the pooling of connections.
>
> When an application calls the method DataSource.getConnection, it gets
> back a Connection object. If connection pooling is being done, that
> Connection object is actually a handle to a PooledConnection object,
> which is a physical connection.
>
> </snip>
>
> Notice that the doc indicates that we as Application programmers donot
> use the PooledConnection and the application uses it indirectly via
> the DataSource.getConnection.
>
>
> Hope this makes things clearer.
> Manglu
>
|
|
|
|
|