1.0

Table Of Contents
The method Statement.getResultSetHoldability() indicates whether a result set generated by the Statement object
stays open or closes upon commit.
When an implicit or explicit commit occurs, result sets that hold cursors open behave as follows:
Open result sets remain open. Non-scrollable result sets become positioned before the next logical row of the
result set. Scrollable insensitive result sets keep their current position.
When the session is terminated, the result set is closed and destroyed.
All locks are released, including locks protecting the current cursor position.
For non-scrollable result sets, immediately following a commit, the only valid operations that can be performed
on the ResultSet object are:
Positioning the result set to the next row with ResultSet.next() .
Closing the result set with ResultSet.close() .
When a rollback or rollback to a savepoint occurs, either explicitly or implicitly, the following behavior applies:
All open result sets are closed.
All locks acquired during the unit of work are released.
Holdable Result Sets and Autocommit
When autocommit is on, a positioned update or delete statement automatically causes the transaction to commit.
If the result set has holdability ResultSet.CLOSE_CURSORS_AT_COMMIT, combined with autocommit
on, SQLFire throws an exception on positioned updates and positioned deletes because the cursor is closed
immediately before the positioned statement is commenced, as mandated by JDBC. In contrast, no such implicit
commit is done when using result set update methods.
Non-Holdable Result Sets and Autocommit
The following example uses Connection.createStatement to return a ResultSet that will close after a
commit is performed:
Connection conn = ds.getConnection(user, passwd);
Statement stmt =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY,
ResultSet.CLOSE_CURSORS_AT_COMMIT);
169
Using Result Sets and Cursors