For DB2 V9.1 and higher for Linux/UNIX/Windows, the DB2 driver supports the XML data type. Which JDBC data type the XML data type is mapped to depends on whether the JDBCBehavior and XMLDescribeType properties are set:
When XMLDescribeType=clob, XML data is returned as character data. The result set column is described with a column type of CLOB and the column type name is xml.
When XMLDescribeType=clob, your application can use the following methods to return data stored in XML columns as character data:
NOTE: The conversion caused by using the getAsciiStream() method may create XML that is not well-formed because the content encoding is not the default encoding and does not contain an XML declaration specifying the content encoding. Do not use the getAsciiStream() method if your application requires well-formed XML.
When XMLDescribeType=blob, your application should not use any of the methods for returning character data described in this section. In this case, the driver applies the standard JDBC character-to-binary conversion to the data, which returns the hexadecimal representation of the character data.
When XMLDescribeType=blob, the driver returns XML data as binary data. The result set column is described with a column type of BLOB and the column type name is xml.
When XMLDescribeType=blob, your application can use the following methods to return XML data as binary data:
The driver does not apply any data conversions to the XML data returned from the database server. These methods return a byte array or binary stream that contains the XML data encoded as UTF-8.
When XMLDescribeType=clob, your application should not use any of the methods for returning binary data described in this section. In this case, the driver applies the standard JDBC binary-to-character conversion to the data, which returns the hexadecimal representation of the binary data.
The driver converts the character representation of the data to the XML character set used by the database server and sends the converted XML data to the server. The driver does not parse or remove any XML processing instructions.
The driver interprets the data supplied to these methods using the ISO-8859-1 (latin 1) encoding. The driver converts the data from ISO-8859-1 to the XML character set used by the database server and sends the converted XML data to the server.