Scalable Database Server, HiRDB Version 8 UAP Development Guide

[Contents][Index][Back][Next]

16.3.1 Result set enhancements

The JDBC2.0 basic standard has added scroll and parallel processing as the extended features of result sets (ResultSet class).

Organization of this subsection
(1) Scroll types
(2) Parallel processing type
(3) Types of result set
(4) Notes about using scroll-type result sets

(1) Scroll types

There are three different scroll types for result sets:

(a) Forward-only type

This is the standard scroll type from JDBC1.0. It allows a result set to be scrolled in the forward direction only (from top to bottom).

(b) Scroll-insensitive type

This is a new scroll type added with JDBC2.0. It allows a result set to be scrolled in a forward or backward direction. It also allows a movement specifying a location relative to the current location or a movement to an absolute location.

Scroll-insensitive means that a change made while a result set is open does not take effect on the result set. In other words, the scroll-insensitive type provides a static view of base data. The rows contained in a result set, their order, and column values are all fixed when the result set is created.

(c) Scroll-sensitive type

This is a new scroll type added with JDBC2.0. While a result set is open, any change made takes effect on the result set.

Changes that take effect may be made directly to the current result set, or made by another result set within the same transaction, or made by another transaction. The number of changes applied depends on the driver's implementation level and DBMS transaction cut-off level.

(2) Parallel processing type

There are two different parallel processing types for result sets:

(a) Read-only type

This is the standard parallel processing type from JDBC1.0. It does not allow data to be updated from its result set.

(b) Updatable type

This is a new parallel processing type added with JDBC2.0. It allows data to be updated (UPDATE, INSERT, and DELETE) from its result set.

(3) Types of result set

When the scroll type and parallel processing type are combined, there are six result set types. Specify the result set type to acquire an instance of the Statement class (or its subclass) using the createStatement method, prepareStatement method, or prepareCall method of the Connection class.

Table 16-5 shows the availability of the result set type when you use the JDBC driver.

Table 16-5 Availability of result set types with JDBC driver

Result set type Availability with JDBC driver
Scroll type Parallel processing type
Forward-only Read-only A
Updatable NA
Scroll-insensitive Read-only A
Updatable NA
Scroll-sensitive Read-only NA
Updatable NA

Legend:
A: Available.
NA: Not available.

Notes
  1. An error occurs if an unavailable result set is specified. In this case, the JDBC driver creates an instance of the Statement class (or its subclass) using the result set that is closest to the specified type, then stores a warning message in SQLWarning of the Connection class.
  2. Some of the methods in the ResultSet class are not available because the JDBC driver does not provide the updatable parallel processing type. If such an unavailable method is called, the JDBC driver unconditionally throws an SQLException. For details about the unavailable methods, see 16.13 Classes and methods with limitations.

(4) Notes about using scroll-type result sets

A scroll-type result set caches all retrieval data in the JDBC driver. If there is a large amount of data, a memory shortage or performance reduction may occur. Therefore, to use a scroll-type result set, you must suppress the retrieval data volume in advance by adding a condition to an SQL statement, for example.