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

Table of Contents

Advertisement

ROWIDs in JDBC with the IBM Data Server Driver for JDBC
and SQLJ
|
|
|
variable that has a data type that is compatible with a CLOB data type. For
example, the following code lets you retrieve a CLOB value into a String
variable:
cstmt.registerOutParameter(parmIndex, java.sql.Types.CLOB);
cstmt.execute();
String charData = cstmt.getString(parmIndex);
v Use the CallableStatement.registerOutParameter call to specify that an output
parameter is of type VARCHAR or LONGVARCHAR:
cstmt.registerOutParameter(parmIndex, java.sql.Types.VARCHAR);
cstmt.execute();
String charData = cstmt.getString(parmIndex);
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.
Related concepts
"LOBs in JDBC applications with the IBM Data Server Driver for JDBC and
SQLJ" on page 49
Related reference
"Data types that map to database data types in Java applications" on page 193
DB2 for z/OS and DB2 for i5/OS
database table. A ROWID is a value that uniquely identifies a row in a table.
Although IBM Informix Dynamic Server (IDS) also supports rowids, those rowids
have the INTEGER data type. You can select an IDS rowid column into a variable
with a four-byte integer data type.
You can use the following ResultSet methods to retrieve data from a ROWID
column:
v getRowId (JDBC 4.0 and later)
v getBytes
v getObject
You can use the following ResultSet method to update a ROWID column of an
updatable ResultSet:
v updateRowId (JDBC 4.0 and later)
updateRowId is valid only if the target database system supports updating of
ROWID columns.
If you are using JDBC 3.0, for getObject, the IBM Data Server Driver for JDBC and
SQLJ returns an instance of the IBM Data Server Driver for JDBC and SQLJ-only
class com.ibm.db2.jcc.DB2RowID.
If you are using JDBC 4.0, for getObject, the IBM Data Server Driver for JDBC and
SQLJ returns an instance of the class java.sql.RowId.
You can use the following PreparedStatement methods to set a value for a
parameter that is associated with a ROWID column:
v setRowId (JDBC 4.0 and later)
v setBytes
v setObject
®
support the ROWID data type for a column in a
Chapter 3. JDBC application programming
55

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents