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.
Note:You cannot use the DB2 JDBC 2.0 driver support for LOB and graphic types in stored procedures or UDFs. To use LOB or graphic types in stored procedures or UDFs, you must use the JDBC 1.22 LOB support. For more information on using using DB2 JDBC 1.22 LOB support with the DB2 JDBC 2.0 driver, see JDBC 2.0 Compatibility.

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.

Treat GRAPHIC and DBCLOB data types as the corresponding CHAR types.

To convert data from the server code page to Unicode, the DB2 client first converts the data from the server code page to the client code page. The client then converts the data from the client code page to Unicode. The following JDBC APIs convert data to or from Unicode:

getString
Converts from server code page to Unicode.

setString
Converts from Unicode to server code page.

getUnicodeStream
Converts from server code page to Unicode.

setUnicodeStream
Converts from Unicode to server code page.

The following JDBC APIs involve conversion between the client code page and the server code page:

setAsciiStream
Converts from client code page to server code page.

getAsciiStream
Converts from server code page to client code page.


[ Top of Page | Previous Page | Next Page ]