5 The DB2 Wire Protocol Driver : Data Types

Data Types
Table 5-2 shows how the DB2 data types map to the standard ODBC data types. “Unicode Support” lists DB2 to Unicode data type mappings.
Table 5-2. DB2 Data Types 

1
Supported on DB2 V8.x and higher for Linux/UNIX/Windows, DB2 V9 and higher for z/OS, and DB2 V5R2 and higher for iSeries.

2
Supported on DB2 V8.x and higher for Linux/UNIX/Windows; DB2 for z/OS; and DB2 V5R2 and higher for iSeries.

3
On DB2 for Linux/UNIX/Windows versions previous to V8.1 and DB2 V5R2 for iSeries, only the first 32 KB of the Clob data are returned when fetching, and only 32 KB can be inserted and updated.

4
Supported only on DB2 V9 and higher for Linux/UNIX/Windows, DB2 V9 and higher for z/OS, and DB2 V6R1 for iSeries.

5
Timestamp values with a fractional seconds precision greater than 9 are described as the ODBC SQL_VARCHAR data type.

6
Timestamp with Time Zone mapping changes based on the setting of the FetchTSWTZasTimestamp option only on DB2 V10 for z/OS.

7
Supported only on DB2 V9.1 and higher for Linux/UNIX/Windows and DB2 V10 for z/OS.

See “Retrieving Data Type Information” for information about retrieving data types.
Using the XML Data Type
By default, DB2 returns XML data to the driver encoded as UTF-8. To avoid data loss, an application must bind XML data as SQL_C_WCHAR. The driver then returns the data as either UTF-8 or UTF-16, depending on platform and application settings. If the application binds XML data as SQL_C_CHAR, the driver converts it to the client character encoding, possibly causing data loss or corruption. To prevent any conversion of XML data, the application must set the attribute XML Describe Type to SQL_LONGVARBINARY (-10) and bind the data as SQL_C_BINARY.