XML Meets DB2 for i
Getting Started With the XML Data Type Using DB2 for IBM i
In 7.1, IBM enhanced DB2 for IBM i with a native XML data type, plus a number of functions and stored procedures for working with XML. The easiest way to understand the new function and how to use it is to first take a close look at both the XML and relational models; and then consider the advantages that a native XML type within DB2 for i offers.
The extensible markup language (XML) has really taken off within the last 10 years or so. XML has a wide number of potential uses, but one of special interest is the case where XML is used as a data model for transmitting information between different applications. Standards that are built on XML for transmitting data exist in every industry.
Relational databases (DB2 for i being among the best) have for many, many years been the method of choice for storing and retrieving business data. DB2 for i has always supported a relational data model for efficiently updating and querying information. IBM has spent a huge amount of time and effort on research and development of an optimizer that knows how to find the fastest way to evaluate an SQL query, with minimal fine-tuning by a DB2 administrator.
Efficient storage, update and query of XML data is a major challenge for the research community. The data model is designed for transmitting business data, and not so much with these performance ideals in mind.
In addition, query and data-manipulation languages written for XML typically don’t yet include the Atomicity, Consistency, Isolation and Durability (ACID) properties that are built into SQL. When using SQL and DB2 for i, commitment control and isolation levels guarantee that even when multiple applications are accessing the same data in the database, the data always remains in a consistent state. IBM i is a very robust platform, but if a catastrophic failure did occur, we know that the database will be in a reliable state when the machine is brought back up again.
The bottom line is that business data is often stored in relational databases, and this is going to be the case for the foreseeable future. However, the same business data often needs to be represented in an XML model, so that it can be transmitted between the database and an XML-aware application.
The result is that XML data and relational data are habitually forced into an unlikely partnership. By supporting a native XML type in 7.1, DB2 for i adds the capability for XML and relational data to coexist within the same database.