Table 6. Valid combinations of resultSetType and resultSetConcurrency for scrollable
ResultSets
resultSetType value resultSetConcurrency value
TYPE_FORWARD_ONLY CONCUR_READ_ONLY
TYPE_FORWARD_ONLY CONCUR_UPDATABLE
TYPE_SCROLL_INSENSITIVE CONCUR_READ_ONLY
TYPE_SCROLL_SENSITIVE
1
CONCUR_READ_ONLY
TYPE_SCROLL_SENSITIVE
1
CONCUR_UPDATABLE
Note:
1. This value does not apply to connections to IBM Informix Dynamic Server.
resultSetHoldability has two possible values: HOLD_CURSORS_OVER_COMMIT and
CLOSE_CURSORS_AT_COMMIT. Either of these values can be specified with any
valid combination of resultSetConcurrency and resultSetHoldability. The value that
you set overrides the default holdability for the connection.
2. If the SELECT statement has input parameters, invoke setXXX methods to pass
values to the input parameters.
3. Invoke the executeQuery method to obtain the result table from the SELECT
statement in a ResultSet object.
4. For each row that you want to access:
a. Position the cursor using one of the methods that are listed in the following
table.
Table 7. ResultSet methods for positioning a scrollable cursor
Method Positions the cursor
first
1
On the first row of the ResultSet
last
1
On the last row of the ResultSet
next
2
On the next row of the ResultSet
previous
1,3
On the previous row of the ResultSet
absolute(int n)
1,4
If n>0, on row n of the ResultSet.Ifn<0, and m is the
number of rows in the ResultSet,onrowm+n+1 of
the ResultSet.
relative(int n)
1,5,6,
If n>0, on the row that is n rows after the current row.
If n<0, on the row that is n rows before the current
row. If n=0, on the current row.
afterLast
1
After the last row in the ResultSet
beforeFirst
1
Before the first row in the ResultSet
Chapter 3. JDBC application programming 39