EasyManuals Logo

IBM DB2 User Manual

IBM DB2
585 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #152 background imageLoading...
Page #152 background image
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
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.
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
ExecutionContext execCtx=myConnCtx.getExecutionContext(); 1
#sql [myConnCtx, execCtx] {CALL MULTRSSP()}; 2
// MULTRSSP returns multiple result sets
ResultSet rs;
while ((rs = execCtx.getNextResultSet()) != null) 3a
{
ResultSetMetaData rsmeta=rs.getMetaData(); 3b
int numcols=rsmeta.getColumnCount();
while (rs.next()) 3c
{
for (int i=1; i<=numcols; i++)
{
String colval=rs.getString(i);
System.out.println("Column"+i+"value is " + colval);
}
}
}
Figure 45. Retrieving result sets from a stored procedure
136 Application Programming Guide and Reference for Java

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the IBM DB2 and is the answer not in the manual?

IBM DB2 Specifications

General IconGeneral
DeveloperIBM
Initial Release1983
LicenseProprietary
Written inC, C++
CategoryDatabase Management System (RDBMS)
Operating SystemLinux, Windows
Programming LanguagesC, C++
Data ModelsRelational
EditionsCommunity, Standard, Advanced
Key Featureshigh availability, scalability