DB2 Version 9.7 for Linux, UNIX, and Windows

DB2Xml interface

The com.ibm.db2.jcc.DB2Xml interface is used for declaring Java™ objects for use with the data server's XML data type.

DB2Xml methods

The following method is defined only for the IBM® Data Server Driver for JDBC and SQLJ.

closeDB2Xml
Format:
public void closeDB2Xml()
  throws SQLException

Releases the resources that are associated with a com.ibm.jcc.DB2Xml object.

getDB2AsciiStream
Format:
public java.io.InputStream getDB2AsciiStream()
  throws SQLException

Retrieves data from a DB2Xml object, and converts the data to US-ASCII encoding.

getDB2BinaryStream
Format:
public java.io.InputStream getDB2BinaryStream()
  throws SQLException

Retrieves data from a DB2Xml object as a binary stream. The character encoding of the bytes in the binary stream is defined in the XML 1.0 specification.

getDB2Bytes
Format:
public byte[] getDB2Bytes()
  throws SQLException

Retrieves data from a DB2Xml object as a byte array. The character encoding of the bytes is defined in the XML 1.0 specification.

getDB2CharacterStream
Format:
public java.io.Reader getDB2CharacterStream()
  throws SQLException

Retrieves data from a DB2Xml object as a java.io.Reader object.

getDB2String
Format:
public String getDB2String()
  throws SQLException

Retrieves data from a DB2Xml object as a String value.

getDB2XmlAsciiStream
Format:
public InputStream getDB2XmlAsciiStream()
  throws SQLException

Retrieves data from a DB2Xml object, converts the data to US-ASCII encoding, and imbeds an XML declaration with an encoding specification for US-ASCII in the returned data.

getDB2XmlBinaryStream
Format:
public java.io.InputStream getDB2XmlBinaryStream(String targetEncoding)
  throws SQLException

Retrieves data from a DB2Xml object as a binary stream, converts the data to targetEncoding, and imbeds an XML declaration with an encoding specification for targetEncoding in the returned data.

Parameter:
targetEncoding
A valid encoding name that is listed in the IANA Charset Registry. The encoding names that are supported by the data server are listed in "Mappings of CCSIDs to encoding names for serialized XML output data".
getDB2XmlBytes
Format:
public byte[] getDB2XmlBytes(String targetEncoding)
  throws SQLException

Retrieves data from a DB2Xml object as a byte array, converts the data to targetEncoding, and imbeds an XML declaration with an encoding specification for targetEncoding in the returned data.

Parameter:
targetEncoding
A valid encoding name that is listed in the IANA Charset Registry. The encoding names that are supported by the data server are listed in "Mappings of CCSIDs to encoding names for serialized XML output data".
getDB2XmlCharacterStream
Format:
public java.io.Reader getDB2XmlCharacterStream()
  throws SQLException

Retrieves data from a DB2Xml object as a java.io.Reader object, converts the data to ISO-10646-UCS-2 encoding, and imbeds an XML declaration with an encoding specification for ISO-10646-UCS-2 in the returned data.

getDB2XmlString
Format:
public String getDB2XmlString()
  throws SQLException

Retrieves data from a DB2Xml object as a String object, converts the data to ISO-10646-UCS-2 encoding, and imbeds an XML declaration with an encoding specification for ISO-10646-UCS-2 in the returned data.

isDB2XmlClosed
Format:
public boolean isDB2XmlClosed()
  throws SQLException

Indicates whether a com.ibm.jcc.DB2Xml object has been closed.