Should an application explicitly close ResultSet objects when using the PreparedStatement cache?
 Technote (FAQ)
 
Problem
Even though the WebSphere® Application Server code will close ResultSet objects before returning the prepared statement objects to the cache, the application code must explicitly close the ResultSet objects.
 
Cause
WebSphere Application Server is not required to close the ResultSet objects for the application, and while the ResultSet objects eventually do close, it is not done immediately. In addition, the JDBC™ driver might not close the ResultSet objects immediately after it receives the ResultSet.close() method from the application.

The result can be a lag between the time the application has called close on the preparedStatement object and the time that the ResultSet is actually removed from memory. On systems with a large Statement cache, this can result in a large build-up of resultSet objects at a single instance, which can cause java.lang.OutOfMemoryErrors to be logged in the SystemOut.log or SystemErr.log.
 
Solution
A J2EE application must explicitly call close on the ResultSet objects to make sure they are removed from memory as soon as possible.
 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > DB Connections/Connection Pooling
Operating system(s): Windows
Software version: 6.0
Software edition:
Reference #: 1155070
IBM Group: Software Group
Modified date: Sep 10, 2004