|
Since you are using the connection pool already, then perhaps
the problem could be due to leaving a statement or results object open when a
connection is given back to the pool.
The only way to be 100% sure that this does not happen is to
free statements and results in a finally clause.
For example:
try {
/* prepare stmt */ stmt = connection.prepareStatement(...); ...
stmt.execute(); ResultSet rs =
stmt.getResultSet();
try { // do something with
rs
} finally { if ( null != rs ) rs.close(); } } finally {
if ( null != stmt ) stmt.close(); } So even if some unexpected exception occurs, the statement is
still freed.
Actually this is more important to do with the statement
itself than the resultset, as resultsets are apparently closed automatically,
but better safe than sorry:
"A result set is automatically closed by the statement that generated it when the statement is closed, executed again, or used to retrieve the next result set from a sequence of multiple result sets." Luther
|
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.