Manipulating XML Data in Java applications

XML, as a built-in data type, was introduced in DB2 9.1. XQuery is the language which is used to query XML data, just as SQL is used to query relational data. Apart from using XQuery, DB2 also provides SQLXML and XMLSQL functions that allow us to query the XML data by using SQL queries and vice versa. Like any SQL statement, XQuery can also be embedded in any host language. In this recipe, we will discuss how we can use XML data in Java applications.

Getting ready

We need the IBM Data Server for the JDBC and SQLJ installed. This driver is shipped as part of DB2.

How to do it...

  1. Retrieving XML Data: XML data can be retrieved in several Java forms such as XML, Object, String, Reader, InputStream, and so on. ...

Get IBM DB2 9.7 Advanced Application Developer Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.