IBM Books

Application Development Guide


Using LOBs and Graphical Objects With JDBC 1.22

The JDBC 2.0 specification for JDK 1.2 defines support for LOBs and graphic types. For more information on the DB2 JDBC 2.0 driver support, see JDBC 2.0.

However, the JDBC 1.22 specification does not explicitly mention large objects (LOBs) or graphic types. DB2 provides the following support for LOBs and graphic types if you use the JDBC 1.22 driver.

If you use LOBs or graphic types in your applications, treat LOBs as the corresponding LONGVAR type. Because LOB types are declared in SQL with a maximum length, ensure that you do not return arrays or strings longer than the declared limit. This consideration applies to SQL string types as well.

For GRAPHIC and DBCLOB types, treat them as the corresponding CHAR types. For conversions involving Unicode, the DB2 client first converts the data from the database format to the client format; DB2 then converts the data to Unicode. The following JDBC APIs involve conversion to or from Unicode:

getString
Converts from database format to Unicode.

setString
Converts from Unicode to database format.

getUnicodeStream
Converts from database format to Unicode.

setUnicodeStream
Converts from Unicode to database format.

The following JDBC APIs involve conversion to or from the local code page format:

setAsciiStream
Converts from local code page to database format.

getAsciiStream
Converts from database format to local code page format.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]