Java applications and Unicode data

Java™ is Unicode-based, and all character processing inside a Java application occurs in Unicode. Character data that is not already in Unicode must be converted before being passed to a Java application. These conversions are handled by Db2 or by the JDBC driver and are transparent to the application.

You can also pass binary data to a Java application to convert into character data. (This statement assumes that you provide the correct Java encoding.)

From a Java programming perspective, you are manipulating objects and do not need to be concerned with the underlying encoding. However, when your Java application communicates with another technology, such as Db2 for z/OS®, conversion might occur. This conversion is handled by Db2 or the JDBC driver, but you should be aware of any conversion costs.

The conversion depends on how you use the driver and how your data is stored in Db2. With IBM® Data Server Driver for JDBC and SQLJ type 2 connectivity on Db2 for z/OS, the driver sends the data in the target server encoding scheme. With IBM Data Server Driver for JDBC and SQLJ type 4 connectivity, the driver sends the data in UTF-8.

IBM Data Server Driver for JDBC and SQLJ type 2 connectivity on Db2 for z/OS uses an SQLDA override to tell Db2 if the encoding scheme is different than the one that was specified at bind time. IBM Data Server Driver for JDBC and SQLJ type 4 connectivity uses DRDA data flows to describe the data. Because this environment is a DRDA environment, Db2 does not use the ENCODING bind option to determine the CCSID of the data or to encode data.

Java can handle both big endian and little endian data. (This statement assumes that you provide the correct Java encoding.)