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.
In addition to moving forward, one row at a time, through a ResultSet, you might
want to do the following things:
v Move backward or go directly to a specific row
v Update, delete, or insert rows in a ResultSet
v Leave the ResultSet open after a COMMIT
The following terms describe characteristics of a ResultSet:
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.
For IBM Informix Dynamic Server data sources, cursors cannot be updatable.
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.
Table 5. JDBC ResultSet characteristics and SQL cursor attributes
JDBC setting DB2 cursor setting
IBM Informix Dynamic Server
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 cursorSensitvity
Connection and DataSource property
Not supported
Important: Like static scrollable cursors in any other language, JDBC static
scrollable ResultSet objects use declared temporary tables for their internal
processing. This means that before you can execute any applications that contain
JDBC static scrollable ResultSet objects, your database administrator needs to
create a temporary database and temporary table spaces for those declared
temporary tables.
Chapter 3. JDBC application programming 37