EasyManuals Logo

IBM DB2 User Manual

IBM DB2
585 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #84 background imageLoading...
Page #84 background image
v Use the ResultSet.getObject method to retrieve the data, and then cast it to the
DB2Xml type and assign it to a DB2Xml object. Then use a DB2Xml.getDB2XXX or
DB2Xml.getDB2XmlXXX method to retrieve the data into a compatible output data
type.
DB2Xml.getDB2XmlXXX methods add XML declarations with encoding
specifications to the output data. DB2Xml.getDB2XXX methods do not add XML
declarations with encoding specifications to the output data.
This technique uses the deprecated DB2Xml objects. Use of the previously
described technique is preferable.
The following table lists the ResultSet methods and corresponding output data
types for retrieving XML data.
Table 15. ResultSet methods and data types for retrieving XML data
Method Output data type
ResultSet.getAsciiStream InputStream
ResultSet.getBinaryStream InputStream
ResultSet.getBytes byte[]
ResultSet.getCharacterStream Reader
ResultSet.getObject DB2Xml
ResultSet.getSQLXML SQLXML
ResultSet.getString String
The following table lists the methods that you can call to retrieve data from a
java.sql.SQLXML or a com.ibm.db2.jcc.DB2Xml object, and the corresponding
output data types and type of encoding in the XML declarations.
Table 16. SQLXML and DB2Xml methods, data types, and added encoding specifications
Method Output data type Type of XML internal encoding declaration added
SQLXML.getBinaryStream InputStream None
SQLXML.getCharacterStream Reader None
SQLXML.getSource Source None
SQLXML.getString String None
DB2Xml.getDB2AsciiStream InputStream None
DB2Xml.getDB2BinaryStream InputStream None
DB2Xml.getDB2Bytes byte[] None
DB2Xml.getDB2CharacterStream Reader None
DB2Xml.getDB2String String None
DB2Xml.getDB2XmlAsciiStream InputStream US-ASCII
DB2Xml.getDB2XmlBinaryStream InputStream Specified by getDB2XmlBinaryStream targetEncoding
parameter
DB2Xml.getDB2XmlBytes byte[] Specified by DB2Xml.getDB2XmlBytes targetEncoding
parameter
DB2Xml.getDB2XmlCharacterStream Reader ISO-10646-UCS-2
DB2Xml.getDB2XmlString String ISO-10646-UCS-2
68 Application Programming Guide and Reference for Java
â„¢

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the IBM DB2 and is the answer not in the manual?

IBM DB2 Specifications

General IconGeneral
DeveloperIBM
Initial Release1983
LicenseProprietary
Written inC, C++
CategoryDatabase Management System (RDBMS)
Operating SystemLinux, Windows
Programming LanguagesC, C++
Data ModelsRelational
EditionsCommunity, Standard, Advanced
Key Featureshigh availability, scalability