DB2 10.5 for Linux, UNIX, and Windows

Retrieval of data in XML columns to earlier DB2 clients

If you retrieve data from an XML column to a client that is at an earlier release than DB2® Version 9.1, your database client cannot handle XML data.

During DRDA® processing, when the database server recognizes a client that cannot support XML data, by default, the DB2 database server describes XML data values as BLOB values and sends the data to the client as BLOB data. The BLOB data is the serialized string representation of the XML data, with a complete XML declaration.

If you want to receive the data as a data type other than a BLOB data type, use one of the following methods:
  • To retrieve the data as CLOB data, ask the administrator of the database server to use the db2set command to set the DB2_MAP_XML_AS_CLOB_FOR_DLC registry variable to YES on the server.

    Important: When you set the DB2_MAP_XML_AS_CLOB_FOR_DLC registry variable to YES on the database server, all DB2 clients at earlier release levels that connect to any database within the instance receive XML data as CLOB data.

    Important: When DB2_MAP_XML_AS_CLOB_FOR_DLC registry variable to YES on the database server, clients receive CLOB data that is the serialized string representation of the XML data, without an XML declaration.

  • To retrieve the data as CLOB, CHAR, or VARCHAR data, invoke the XMLSERIALIZE function on the column data to instruct the DB2 database server to convert the data to the specified data type before it sends the data to the client.

When you do not invoke XMLSERIALIZE to retrieve data from a database server to a client at an earlier release level, the column from which you retrieve the data does not behave exactly like a BLOB or CLOB column. For example, although you can use the LIKE predicate on a BLOB column, you cannot use the LIKE predicate on an XML column that returns BLOB or CLOB data.