Hello,

we just moved our app to excalibur datasource (leaving WebLogic). Now, I
am seeing cursor exhaustion from the database. The offending code on the
client side goes something like:

Connection conn = dataSource.getConnection();
try 
{
    Statememnt st = conn.createStatement("...");
    ResultSet rs = st.executeStatement();
}
finally
{
    // connection is closed, but dependent objects are NOT
    conn.close();
}

Here we depend on a somewhat underspecified contract of
java.sql.Connection.close(), which states:

  Releases a Connection's database and JDBC resources immediately
  instead of waiting for them to be automatically released.

So, our reading of this is: all statements allocated on the connection
will be closed. Apparently our reading doesn't match that of
AbstractJdbcConnection, which doesn't close the statements open on the
original connection. Such mismatch creates orphaned Statements,
ResultSets, and ultimately database cursors.

So, my question is: would you consider it useful to track all
java.sql.Statements created by a pool connection and close them all in
AbstractJdbcConnection.close?

The implementation will include a Vector (for synchronization) of
Statements kept in AbstractJdbcConnection. The vector will be populated
by createStatement, prepareStatement, prepareCall methods of
AbstractJdbcConnection's descendants and all statements will be closed
by AbstractJdbcConnection.close. Duplicate calls to Statement.close are
safe according to java.sql javadoc. Thus, it is not necessary to track
if a statement has been closed already and we don't have to create extra
wrappers.

If folks don't feel that such addition is useful I will simply extend
JdbcConnection in our application to do what I need. Luckily
JdbcDataSource allows me to do that without touching datasource
code. Great design, Berin!

Thanks
Greg

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to