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 #155 background imageLoading...
Page #155 background image
This technique should be used only if you know that the length of the retrieved
data is less than or equal to 32KB. Otherwise, the data is truncated.
Output parameters for DBCLOB columns
DBCLOB output or input/output parameters for stored procedures are not
supported.
Related concepts
“LOBs in SQLJ applications with the IBM Data Server Driver for JDBC and
SQLJ” on page 136
Related reference
“Data types that map to database data types in Java applications” on page 193
SQLJ and JDBC in the same application
You can combine SQLJ clauses and JDBC calls in a single program.
To do this effectively, you need to be able to do the following things:
v Use a JDBC Connection to build an SQLJ ConnectionContext, or obtain a JDBC
Connection from an SQLJ ConnectionContext.
v Use an SQLJ iterator to retrieve data from a JDBC ResultSet or generate a JDBC
ResultSet from an SQLJ iterator.
Building an SQLJ ConnectionContext from a JDBC Connection: To do that:
1. Execute an SQLJ connection declaration clause to create a ConnectionContext
class.
2. Load the driver or obtain a DataSource instance.
3. Invoke the JDBC DriverManager.getConnection or DataSource.getConnection
method to obtain a JDBC Connection.
4. Invoke the ConnectionContext constructor with the Connection as its argument
to create the ConnectionContext object.
Obtaining a JDBC Connection from an SQLJ ConnectionContext: To do this,
1. Execute an SQLJ connection declaration clause to create a ConnectionContext
class.
2. Load the driver or obtain a DataSource instance.
3. Invoke the ConnectionContext constructor with the URL of the driver and any
other necessary parameters as its arguments to create the ConnectionContext
object.
4. Invoke the JDBC ConnectionContext.getConnection method to create the JDBC
Connection object.
See Connect to a data source using SQLJ for more information on SQLJ
connections.
Retrieving JDBC result sets using SQLJ iterators: Use the iterator conversion
statement to manipulate a JDBC result set as an SQLJ iterator. The general form of
an iterator conversion statement is:
#sql iterator={CAST :result-set};
Before you can successfully cast a result set to an iterator, the iterator must
conform to the following rules:
v The iterator must be declared as public.
Chapter 4. SQLJ application programming 139

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