v To keep the current ResultSet open when you check for the next ResultSet,
specify a value of Statement.KEEP_CURRENT_RESULT for current.
v To close the current ResultSet when you check for the next ResultSet, specify a
value of Statement.CLOSE_CURRENT_RESULT for current.
v To close all ResultSet objects, specify a value of Statement.CLOSE_ALL_RESULTS
for current.
Example: The following code keeps all ResultSets open until the final ResultSet
has been retrieved, and then closes all ResultSets.
CallableStatement cstmt;
...
boolean resultsAvailable = cstmt.execute(); // Call the stored procedure
if (resultsAvailable==true) { // Test for result set
ResultSet rs1 = cstmt.getResultSet(); // Get a result set
... // Process ResultSet
resultsAvailable = cstmt.getMoreResults(Statement.KEEP_CURRENT_RESULT);
// Check for next result set
// but do not close
// previous result set
if (resultsAvailable==true) { // Test for another result set
ResultSet rs2 = cstmt.getResultSet(); // Get next result set
... // Process either ResultSet
}
}
resultsAvailable = cstmt.getMoreResults(Statement.CLOSE_ALL_RESULTS);
// Close the result sets
LOBs in JDBC applications with the IBM Data Server Driver
for JDBC and SQLJ
The IBM Data Server Driver for JDBC and SQLJ supports methods for updating
and retrieving data from BLOB, CLOB, and DBCLOB columns in a table, and for
calling stored procedures or user-defined functions with BLOB or CLOB
parameters.
Related concepts
“Java data types for retrieving or updating LOB column data in JDBC
applications” on page 53
“Memory use for IBM Data Server Driver for IBM Data Server Driver for JDBC
and SQLJ type 2 connectivity on DB2 for z/OS” on page 98
Related reference
“Driver support for JDBC APIs” on page 252
“JDBC differences between the current IBM Data Server Driver for JDBC and
SQLJ and earlier DB2 JDBC drivers” on page 370
“Properties for the IBM Data Server Driver for JDBC and SQLJ” on page 201
Progressive streaming with the IBM Data Server Driver for JDBC
and SQLJ
If the data source supports progressive streaming, also known as dynamic data
format, the IBM Data Server Driver for JDBC and SQLJ can use progressive
streaming to retrieve data in LOB or XML columns.
DB2 for z/OS Version 9.1 and later supports progressive streaming for LOBs and
XML objects. DB2 Database for Linux, UNIX, and Windows Version 9.5 and later,
IBM Informix Dynamic Server (IDS) Version 11.50 and later, and DB2 for i V6R1
and later support progressive streaming for LOBs.
Chapter 3. JDBC application programming 49
|
|
|
|