Lobs In Sqlj Applications With The Ibm Data Server Driver For Jdbc And Sqlj - IBM DB2 Manual

Table of Contents

Advertisement

ExecutionContext execCtx=myConnCtx.getExecutionContext();
#sql [myConnCtx, execCtx] {CALL MULTRSSP()};
ResultSet rs;
while ((rs = execCtx.getNextResultSet()) != null)
{
}
Figure 45. Retrieving result sets from a stored procedure
LOBs in SQLJ applications with the IBM Data Server Driver for
JDBC and SQLJ
With the IBM Data Server Driver for JDBC and SQLJ, you can retrieve LOB data
into Clob or Blob host expressions or update CLOB, BLOB, or DBCLOB columns
from Clob or Blob host expressions. You can also declare iterators with Clob or
Blob data types to retrieve data from CLOB, BLOB, or DBCLOB columns.
Retrieving or updating LOB data: To retrieve data from a BLOB column, declare
an iterator that includes a data type of Blob or byte[]. To retrieve data from a
CLOB or DBCLOB column, declare an iterator in which the corresponding column
has a Clob data type.
To update data in a BLOB column, use a host expression with data type Blob. To
update data in a CLOB or DBCLOB column, use a host expression with data type
Clob.
Progressive streaming or LOB locators: In SQLJ applications, you can use
progressive streaming, also known as dynamic data format, or LOB locators in the
same way that you use them in JDBC applications.
136
Application Programming Guide and Reference for Java
// MULTRSSP returns multiple result sets
ResultSetMetaData rsmeta=rs.getMetaData();
int numcols=rsmeta.getColumnCount();
while (rs.next())
{
for (int i=1; i<=numcols; i++)
{
String colval=rs.getString(i);
System.out.println("Column " + i + "value is " + colval);
}
}
Related concepts
"SQL statement execution in SQLJ applications" on page 112
Related tasks
"Calling stored procedures in an SQLJ application" on page 134
"Writing a Java stored procedure to return result sets" on page 178
Related concepts
"SQL statement execution in SQLJ applications" on page 112
"Java data types for retrieving or updating LOB column data in SQLJ
applications" on page 137
Related reference
"Data types that map to database data types in Java applications" on page 193
"Properties for the IBM Data Server Driver for JDBC and SQLJ" on page 201
1
2
3a
3b
3c

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents