Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

OracleConnection and Websphere  RSS feed

Anant Kabra
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are trying to use Websphere 5.0.1 with Oracle 9i as the database.
The problem is that when doing connection pooling through the application server, you get an object which is specific to the application server. We need to get an OracleConnection object. This is no problem under orion (oracle AS). With Weblogic, we are able to use the getVendorConnection to get the physical underlying object which returns the OracleConnection object, but with websphere there seems to be no way to do this...
I've tried a few different approaches as outlined below.
I would really appreciate any help. Thanks
We are trying to use oracle with websphere.
Websphere 5.0.1
Oracle JDBC driver from 9i release
We need to get an OracleConnection from the pool, and since the configured pool in websphere returns a websphere specific implementation class for the pooled connection, which cannot be cast to oracleconnection, we are stuck with implementing our own pool. I tried the following two methods with the described problems.
1. Using JNDI
We create an OracleConnectionCacheImpl object and put it in JNDI. To get a connection, a JNDI lookup on this object is done and the getConnection method is called.
This results in what seems like a new pool being created each time a JNDI lookup is done on the object. So each time we do a getConnection, a new connection to the database is opened. Obviously not what we want. This problem seems to be described in the oracle 8.1.6 documentation for OracleConnectionCacheImpl...

OracleConnectionCacheImpl support for JNDI is not complete in release 8.1.6--an instance obtained through a lookup call does not have any connections opened; however, the connection properties, caching scheme, and limits for the number of pooled connections are retained.
But there is no mention of this in the 9i documentation, so I thought the problem was fixed, but the issue we are encoutering looks very similar to this.
2. Singleton
So we implemented this using a singleton. The singleton instantiates an OracleConnectionCacheImpl object and returns this through a getter method. This object is used to getConnection. This seems to work at least as far as the pooling is concerned, but results in another problem. We are using the oracle jpub package, and we get a
java.sql.SQLException: Logical handle no longer valid
exception on some methods for mutablearrays or mutablestructs. This does not happen when using the JNDI implementation, or if getting a connection through drivermanager. The stack trace is attached below.
Please any help would be appreciated. Let me know if you need more info.
PS: With weblogic, there is a getVendorConnection method in the PooledConnection class implementation. This returns the underlying physical connection for the logical connection. Is there a similar method for websphere?
-- Anant
java.sql.SQLException: Logical handle no longer valid
at oracle.jdbc.dbaccess.DBError.throwSqlException(
at oracle.jdbc.dbaccess.DBError.throwSqlException(
at oracle.jdbc.dbaccess.DBError.throwSqlException(
at oracle.jdbc.driver.OracleConnection.checkPhyiscalStatus(
at oracle.jdbc.driver.OracleConnection.privateCreateStatement(
at oracle.jdbc.driver.OracleConnection.createStatement(
at oracle.jdbc.oracore.OracleTypeCOLLECTION.initCollElemTypeName(
at oracle.jdbc.oracore.OracleTypeCOLLECTION.getAttributeType(
at oracle.jdbc.oracore.OracleNamedType.getFullName(
at oracle.jdbc.oracore.OracleTypeADT.createStructDescriptor(
at oracle.jdbc.oracore.OracleTypeADT.unpickle81(
at oracle.jdbc.oracore.OracleTypeUPT.unpickle81UPT(
at oracle.jdbc.oracore.OracleTypeUPT.unpickle81rec(
at oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle81_imgBody_elems(
at oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle81_imgBody(
at oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle81(
at oracle.jdbc.oracore.OracleTypeCOLLECTION._unlinearize(
at oracle.jdbc.oracore.OracleTypeCOLLECTION.unlinearize(
at oracle.sql.ArrayDescriptor.toOracleArray(
at oracle.sql.ARRAY.getOracleArray(
at oracle.jpub.runtime.MutableArray.getLazyOracleArray(
at oracle.jpub.runtime.MutableArray.length(
at com.mycompany.presvc.predatasvc.MeasureListWrapDA.getArray(
at com.mycompany.presvc.predatasvc.MetricDAO.convertToArg(
at com.mycompany.presvc.predatasvc.MetricGraphDAO.getFullGraph(
at com.mycompany.presvc.predatasvc.ejb.PreDataSvcEJB.getMetricGraph(
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!