IBM DB2 Manual page 58

Table of Contents

Advertisement

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42
Application Programming Guide and Reference for Java
If the data source does not have support for multi-row FETCH, the IBM Data
Server Driver for JDBC and SQLJ performs the multi-row FETCH operations.
When you retrieve data in your applications, the IBM Data Server Driver for JDBC
and SQLJ determines whether to use multi-row FETCH, depending on several
factors:
v The settings of the enableRowsetSupport and useRowsetCursor properties
v The type of IBM Data Server Driver for JDBC and SQLJ connectivity that is
being used
v Whether progressive streaming is being used to fetch the rows
For IBM Data Server Driver for JDBC and SQLJ type 4 connectivity to DB2 for
z/OS or DB2 Database for Linux, UNIX, and Windows, and IBM Data Server
Driver for JDBC and SQLJ type 2 connectivity on DB2 Database for Linux, UNIX,
and Windows, the setting of the enableRowsetSupport property overrides the
setting of the useRowsetCursor property. For IBM Data Server Driver for JDBC and
SQLJ type 2 connectivity on DB2 for z/OS, the useRowsetCursor property is not
used.
If the IBM Data Server Driver for JDBC and SQLJ uses progressive streaming to
retrieve rows, the driver cannot use multi-row FETCH to retrieve those rows.
For IBM Data Server Driver for JDBC and SQLJ type 2 connectivity on DB2 for
z/OS, you can control the maximum size of a rowset for each statement by setting
the maxRowsetSize property.
Multi-row positioned UPDATE or DELETE
The IBM Data Server Driver for JDBC and SQLJ supports a technique for
performing positioned update or delete operations that follows the JDBC 1
standard. That technique involves using the ResultSet.getCursorName method to
obtain the name of the cursor for the ResultSet, and defining a positioned
UPDATE or positioned DELETE statement of the following form:
UPDATE table SET col1=value1,...coln=valueN WHERE CURRENT OF cursorname
DELETE FROM table WHERE CURRENT OF cursorname
Multi-row UPDATE or DELETE when useRowsetCursor is set to true: If you use the
JDBC 1 technique to update or delete data on a database server that supports
multi-row FETCH, and multi-row FETCH is enabled through the useRowsetCursor
property, the positioned UPDATE or DELETE statement might update or delete
multiple rows, when you expect it to update or delete a single row. To avoid
unexpected updates or deletes, you can take one of the following actions:
v Use an updatable ResultSet to retrieve and update one row at a time, as shown
in the previous example.
v Use the FOR ROW n OF ROWSET clause in your UPDATE or DELETE
statements, to specify a specific row to modify or delete.
v Set useRowsetCursor to false.
Multi-row UPDATE or DELETE when enableRowsetSupport is set to
com.ibm.db2.jcc.DB2BaseDataSource.YES (1): The JDBC 1 technique for updating or
deleting data is incompatible with multi-row FETCH that is enabled through the
enableRowsetSupport property. If you use the JDBC 1 technique, disable multi-row
FETCH by setting the enableRowsetSupport property to
com.ibm.db2.jcc.DB2BaseDataSource.NO (2).

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents