Using Oracle cursors with WebSphere datasource
 Technote (FAQ)
 
Problem
A connection returned from a datasource returns a ClassCastException when a cast to a vendor-specific connection class is attempted. Therefore, vendor specific functions are not available for use because there are restrictions when using vendor specific functions. A Java™ code example is provided.
 
Solution
This technique has the following considerations:
  1. Connection manager (CM) cannot track any objects created using the physical connection; therefore:
    1. CallableStatement is not cached.

    2. The application must take care of closing the CallableStatement and the ResultSet from the getCursor call.

    3. Stale connection exception handling is not done when the CallableStatement or ResultSet is processed.

  2. Orphan timeout might terminate the connection while it is still being used; therefore, the timeout value must be set to a large enough value to cover the amount of time for processing, or it must be turned off.

  3. If AutoCommit is turned off and commit or rollback is not done, CM does not detect this because CM thinks nothing happened on the connection and does not do an auto rollback. It is up to the application to ensure a commit or rollback is done. Failure of the application to take care of these items can cause a dirty connection to be put back into the connection free pool, which could cause other problems.

Refer to the OracleCallableStatementServlet.java.
 
OracleCallableStatementServlet.java
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Java 2 Connectivity (J2C)
Operating system(s): Windows
Software version: 4.0
Software edition:
Reference #: 1104471
IBM Group: Software Group
Modified date: Mar 31, 2006