Scalable Database Server, HiRDB Version 8 UAP Development Guide

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

17.7.39 setMaxBinarySize

(a) Function

Sets the maximum data size for retrieval of data of the LONGVARBINARY type (a JDBC SQL type).

(b) Format
 
public void setMaxBinarySize ( int size ) throws SQLException
 
(c) Arguments

int size
Specifies the maximum data size, in the range from 0 to 2,147,483,647.
If 0 is specified, the defined length of the data to be retrieved is set as the maximum size.
(d) Return value

None.

(e) Functional detail

Sets the maximum data size (bytes) when data of the LONGVARBINARY JDBC SQL type is retrieved.

When the JDBC driver retrieves LONGVARBINARY data, it allocates memory of the defined length because it cannot recognize the actual data length until it retrieves the data. Consequently, if the JDBC driver retrieves values from a column that is very large, such as 2,147,483,647 bytes (the maximum size for HiRDB's BINARY and BLOB data types), it attempts to allocate memory space of the defined length (2,147,483,647 bytes) as the defined length. Depending on the execution environment, this may cause a memory shortage.

You should use this method to specify the maximum length of the data that is actually stored. If the defined length of the BINARY and BLOB data to be retrieved is larger than the size specified by this method, the JDBC driver truncates the retrieved data to the specified size. When data has been truncated, the JDBC driver receives a warning from the HiRDB server when the next method of ResultSet is executed. The JDBC driver responds to the received warning by throwing an SQLException or issuing (or ignoring) an SQLWarning, as specified by the setLONGVARBINARY_TruncError value.

If a maximum data size has not been set by this method, the defined length of the data to be retrieved is used as the maximum data size.

(f) Exceptions

If a negative value is specified, this method throws an SQLException.

(g) Notes

Any value specified for this method is not effective when LOCATOR is specified in the mode argument of the setLONGVARBINARY_Access method. In such a case, the JDBC driver allocates an area based on the actual data length and retrieves all of the data.