Characteristics of a JDBC ResultSet under the IBM Data Server Driver for JDBC and SQLJ
The IBM® Data Server Driver for JDBC and SQLJ provides support for scrollable, updatable, and holdable cursors.
- Move backward or go directly to a specific row
- Update, delete, or insert rows in a ResultSet
- Leave the ResultSet open after a COMMIT
- scrollability
- Whether the cursor for the ResultSet can move
forward only, or forward one or more rows, backward one or more rows,
or to a specific row.
If a cursor for a ResultSet is scrollable, it also has a sensitivity attribute, which describes whether the cursor is sensitive to changes to the underlying table.
- updatability
- Whether the cursor can be used to update or delete rows. This characteristic does not apply to a ResultSet that is returned from a stored procedure, because a stored procedure ResultSet cannot be updated.
- holdability
- Whether the cursor stays open after a COMMIT.
You set the updatability, scrollability, and holdability characteristics
of a ResultSet through parameters in the Connection.prepareStatement or Connection.createStatement
methods.
The ResultSet settings map to attributes of a cursor
in the database. The following table lists the JDBC scrollability,
updatability, and holdability settings, and the corresponding cursor
attributes.
JDBC setting | Db2® cursor setting | IBM Informix® cursor setting |
---|---|---|
CONCUR_READ_ONLY | FOR READ ONLY | FOR READ ONLY |
CONCUR_UPDATABLE | FOR UPDATE | FOR UPDATE |
HOLD_CURSORS_OVER_COMMIT | WITH HOLD | WITH HOLD |
TYPE_FORWARD_ONLY | SCROLL not specified | SCROLL not specified |
TYPE_SCROLL_INSENSITIVE | INSENSITIVE SCROLL | SCROLL |
TYPE_SCROLL_SENSITIVE | SENSITIVE STATIC, SENSITIVE DYNAMIC, or ASENSITIVE, depending on the cursorSensitivity Connection and DataSource property | Not supported |
If a JDBC ResultSet is static, the size of the result table and the order of the rows in the result table do not change after the cursor is opened. This means that if you insert rows into the underlying table, the result table for a static ResultSet does not change. If you delete a row of a result table, a delete hole occurs. You cannot update or delete a delete hole.