IBM DB2 Manual page 391

Table of Contents

Advertisement

Default mappings for PreparedStatement.setXXXStream
With the IBM Data Server Driver for JDBC and SQLJ, when you use the
PreparedStatement.setBinaryStream , PreparedStatement.setCharacterStream, or
PreparedStatement.setUnicodeStream method, and no information about the data
type of the target column is available, the input data is mapped to a BLOB or
CLOB data type.
For the JDBC/SQLJ driver for z/OS, the input data is mapped to a VARCHAR
FOR BIT DATA or VARCHAR data type.
How character conversion is done
When character data is transferred between a client and a server, the data must be
converted to a form that the receiver can process.
For the IBM Data Server Driver for JDBC and SQLJ, character data that is sent
from the data source to the client is converted using Java's built-in character
converters. The conversions that the IBM Data Server Driver for JDBC and SQLJ
supports are limited to those that are supported by the underlying JRE
implementation.
A IBM Data Server Driver for JDBC and SQLJ client using type 4 connectivity
sends data to the data source as Unicode UTF-8.
The conversions that the JDBC/SQLJ driver for z/OS and the IBM Data Server
Driver for JDBC and SQLJ with type 2 connectivity support are also limited to
those that are supported by the underlying JRE implementation.
Those drivers use CCSID information from the data source if it is available. The
drivers convert input parameter data to the CCSID of the data source before
sending the data. If target CCSID information is not available, the drivers send the
data as Unicode UTF-8.
Implicit or explicit data type conversion for input parameters
If you execute a PreparedStatement.setXXX method, and the resulting data type
from the setXXX method does not match the data type of the table column to
which the parameter value is assigned, the driver returns an error unless data type
conversion occurs.
With the IBM Data Server Driver for JDBC and SQLJ, conversion to the correct
SQL data type occurs implicitly if the target data type is known and if the
deferPrepares and sendDataAsIs connection properties are set to false. In this
case, the implicit values override any explicit values in the setXXX call. If the
deferPrepares connection property or the sendDataAsIs connection property is set
to true, you must use the PreparedStatement.setObject method to convert the
parameter to the correct SQL data type.
For the JDBC/SQLJ driver for z/OS, if the data type of a parameter does not
match its default SQL data type, you must use the PreparedStatement.setObject
method to convert the parameter to the correct SQL data type.
375
Chapter 7. JDBC and SQLJ reference information

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents