IBM DB2 Manual page 66

Table of Contents

Advertisement

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50
Application Programming Guide and Reference for Java
With progressive streaming, the data source dynamically determines the most
efficient mode in which to return LOB or XML data, based on the size of the LOBs
or XML objects.
For IBM Data Server Driver for JDBC and SQLJ version 3.50 and later, progressive
streaming behavior is the default for LOB retrieval, for connections to DB2
Database for Linux, UNIX, and Windows Version 9.5 and later and IDS Version
11.50 and later.
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,
and IBM Informix Dynamic Server (IDS) Version 11.50 and later support
progressive streaming for LOBs.
For DB2 for z/OS Version 9.1 and later data sources, or DB2 Database for Linux,
UNIX, and Windows Version 9.5 and later data sources:
v If the IBM Data Server Driver for JDBC and SQLJ progressiveStreaming
property is DB2BaseDataSource.YES, your application uses progressive streaming
behavior.
If you call
v
DB2Connection.setDB2ProgressiveStreaming(DB2BaseDataSource.YES), all
ResultSet objects that are created on the connection use progressive streaming
behavior.
When progressive streaming is enabled, you can control when the JDBC driver
materializes LOBs with the streamBufferSize property. If a LOB or XML object is
less than or equal to the streamBufferSize value, the object is materialized.
Important: With progressive streaming, when you retrieve a LOB or XML value
from a ResultSet into an application variable, you can manipulate the contents of
that application variable until you move the cursor or close the cursor on the
ResultSet. After that, the contents of the application variable are no longer
available to you. If you perform any actions on the LOB in the application variable,
you receive an SQLException. For example, suppose that progressive streaming is
enabled, and you execute statements like this:
...
ResultSet rs = stmt.executeQuery("SELECT CLOBCOL FROM MY_TABLE");
rs.next();
Clob clobFromRow1 = rs.getClob(1);
String substr1Clob = clobFromRow1.getSubString(1,50);
rs.next();
// String substr2Clob = clobFromRow1.getSubString(51,100);
Clob clobFromRow2 = rs.getClob(1);
rs.close();
After you execute rs.next() to position the cursor at the second row of the
ResultSet, the CLOB value in clobFromRow1 is no longer available to you.
Similarly, after you execute rs.close() to close the ResultSet, the values in
clobFromRow1 and clobFromRow2 are no longer available.
// Retrieve the first row of the ResultSet
// Put the CLOB from the first column of
// the first row in an application variable
// Retrieve the first 50 bytes of the CLOB
// Move the cursor to the next row.
// clobFromRow1 is no longer available.
// This statement would yield an SQLException
// Put the CLOB from the first column of
// the second row in an application variable
// Close the ResultSet.
// clobFromRow2 is also no longer available.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents