IBM DB2 Manual page 393

Table of Contents

Advertisement

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Progressive streaming is supported in the IBM Data Server Driver for JDBC and
SQLJ Version 3.1 and later, but for IBM Data Server Driver for JDBC and SQLJ
version 3.2 and later, progressive streaming behavior is the default for LOB and
XML retrieval, for connections to DB2 for z/OS Version 9.1 and later.
Previous versions of the IBM Data Server Driver for JDBC and SQLJ did not
support progressive streaming.
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.
To avoid errors that are due to this changed behavior, you need to take one of the
following actions:
v Modify your applications.
Applications that retrieve LOB data into application variables can manipulate
the data in those application variables only until the cursors that were used to
retrieve the data are moved or closed.
v Disable progressive streaming by setting the progressiveStreaming property to
DB2BaseDataSource.NO (2).
ResultSetMetaData values for IBM Data Server Driver for JDBC
and SQLJ version 4.0 and later
For the IBM Data Server Driver for JDBC and SQLJ version 4.0 and later, the
default behavior of ResultSetMetaData.getColumnName and
ResultSetMetaData.getColumnLabel differs from the default behavior for earlier
JDBC drivers.
If you need to use IBM Data Server Driver for JDBC and SQLJ version 4.0 or later,
but your applications need to return the ResultSetMetaData.getColumnName and
ResultSetMetaData.getColumnLabel values that were returned with older JDBC
// 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.
Chapter 7. JDBC and SQLJ reference information
377

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents