IBM DB2 Manual page 53

Table of Contents

Advertisement

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
updatability
holdability
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
CONCUR_READ_ONLY
CONCUR_UPDATABLE
HOLD_CURSORS_OVER_COMMIT
TYPE_FORWARD_ONLY
TYPE_SCROLL_INSENSITIVE
TYPE_SCROLL_SENSITIVE
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.
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.
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.
Whether the cursor stays open after a COMMIT.
DB2 cursor setting
FOR READ ONLY
FOR UPDATE
WITH HOLD
SCROLL not specified
INSENSITIVE SCROLL
SENSITIVE STATIC, SENSITIVE
DYNAMIC, or ASENSITIVE,
depending on the cursorSensitvity
Connection and DataSource property
IBM Informix Dynamic Server
cursor setting
FOR READ ONLY
FOR UPDATE
WITH HOLD
SCROLL not specified
SCROLL
Not supported
Chapter 3. JDBC application programming
37

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents