XML data encoding

The encoding of XML data can be derived from the data itself, which is known as internally encoded data, or from external sources, which is known as externally encoded data.

The application data type that you use to exchange the XML data between the application and the XML column determines how the encoding is derived.

  • XML data that is in character or graphic application data types is considered to be externally encoded. Like character and graphic data, XML data that is in these data types is considered to be encoded in:
    • The application code page, if the encoding is not specified in an SQLDA
    • The value that is specified by the CCSID, if a CCSID is specified in an SQLDA
  • XML data that is in a binary application data type or has a bit data subtype is considered to be internally encoded.

Externally coded XML data might contain internal encoding, such as when an XML document in a character data type contains an encoding declaration. When you send externally encoded data to a Db2 database, the database manager ignores internal encoding.