A holdable cursor, or result does not automatically close when the transaction that
contains the cursor is committed. You must specify the holdability of a
ResultSet object.
JDBC 3.0 supports specifying cursor holdability. You must specify the holdability of your
ResultSet when you prepare a statement using the
createStatement(),
prepareStatement(), or
prepareCall() methods. The holdability may be one of the
following constants:
-
HOLD_CURSORS_OVER_COMMIT – ResultSet objects (cursors)
are not closed; they are held open when a commit
operation is implicitly or explicitly performed.
-
CLOSE_CURSORS_AT_COMMIT – ResultSet objects (cursors)
are closed when a commit operation is implicitly or
explicitly performed.
Closing a cursor when a transaction is committed usually results in
better performance. Unless you require the cursor after the transaction, SAP
recommends that you close the cursor when the commit
operation is carried out. Because the specification does not define the
default holdability of a ResultSet, its behavior
depends on the implementation.