Hitachi

Hitachi Advanced Database Application Development Guide


8.3.37 setFetchSize(int rows)

Organization of this subsection

(1) Function

This method specifies the default fetch size (number of retrieval result rows to be transferred from the HADB server to the HADB client in the batch mode) for a ResultSet object that is created from this Statement object.

(2) Format

public synchronized void setFetchSize(int rows) throws SQLException

(3) Arguments

int rows

Specifies the number of rows to be transferred in the batch mode, in the range from 0 to 65,535.

If the specified value is 1 or greater, the JDBC driver transfers the specified number of rows of data from the HADB server to the HADB client in the batch mode.

If 0 is specified or this method is not executed, the value of adb_clt_fetch_size in the system properties, user properties, or URL connection properties is applied.

The following table shows the relationship between the setFetchSize method setting and the adb_clt_fetch_size property setting.

Table 8‒11: Relationship between the setFetchSize method setting and the adb_clt_fetch_size property setting

setFetchSize method setting (m)

adb_clt_fetch_size property setting (n)

Number of rows to be transferred in the batch mode

0

1 ≤ n ≤ 65,535

n

Not specified

1

1 ≤ m ≤ 65,535

1 ≤ n ≤ 65,535

m

Not specified

m

(4) Return value

None.

(5) Exceptions

The JDBC driver throws an SQLException in the following cases:

(6) Notes

The following table shows the priority order for determining the number of rows that the JDBC driver requests the HADB server to transfer in a single transmission.

Table 8‒12: Priorities for number of rows that the JDBC driver requests the HADB server to transfer in one transmission

Priority

Number of rows that the JDBC driver requests the HADB server to transfer in one transmission

1

Value specified in the argument of the setFetchSize method of the ResultSet class

2

Value specified in the argument of the setFetchSize method of the Statement class

3

Value specified in the adb_clt_fetch_size system property

4

adb_clt_fetch_size property value specified in the info argument of the getConnection method of the DriverManager class

5

Value of adb_clt_fetch_size specified in the url argument of the getConnection method of the DriverManager class

If the retrieval result is larger than the number of transfer rows shown in the table above, the JDBC driver requests transfer to the HADB server as many times as necessary until retrieval is completed (or until all retrieval requests from the application program have been processed).