6.1.9 Holdability It is sometimes the case that any ResultSet objects created during a transaction are closed when the transaction is committed. If that is not the desired behavior, a ResultSet object may be created so that it stays open after the Connection method commit has been called. (This is sometimes referred to as holding a cursor over a commit.) Such a ResultSet object will remain open until it is explicitly closed; therefore, an application should call the method ResultSet.close on it as soon as it is no longer needed.
To specify the holdability of ResultSet objects that are created, the following constants can be supplied to the Connection methods createStatement, prepareStatement, and prepareCall:
ResultSet.HOLD_CURSORS_OVER_COMMIT ResultSet objects (cursors) are not closed; they are held open when the method commit is called. ResultSet.CLOSE_CURSORS_AT_COMMIT ResultSet objects (cursors) are closed when the method commit is called. Closing cursors at commit can result in better performance for some applications. The default holdability of a ResultSet object depends on how the DBMS and driver are implemented. You can call the DatabaseMetaData method getResultSetHoldability to get the default holdability for result sets returned by your DBMS and driver.