XML Extender Administration and Programming
The XML Extender provides two access and storage methods to use DB2 as an
XML repository: XML column and XML collection. You first need to
decide which of the methods best matches your application needs for accessing
and manipulating XML data.
- XML column
- Stores and retrieves entire XML documents as DB2 column data. The
XML data is represented by an XML column.
- XML collection
- Decomposes XML documents into a collection of relational tables or
composes XML documents from a collection of relational tables.
The nature of your application determines the type of access and storage
method to use and how to structure your XML data. The following
scenarios describe situations in which each access and storage method is the
most appropriate.
Use XML columns in the following situations:
- The XML documents already exist or come from some external source and you
prefer to store the documents in the native XML format. You want to
store them in DB2 for integrity and for archival and auditing purposes.
- The XML documents are generally read, but not updated.
- You want to use file name data types to store the XML documents external
to DB2 in the local or remote file system and to use DB2 for management and
search operations.
- You need range search based on the values of XML elements or attributes,
and you know what elements or attributes will frequently be the search
arguments.
- The documents have elements with large text blocks and you want to use the
DB2 Text Extender for structural text search while keeping the entire
documents intact.
Use XML collections in the following situations:
- You have data in your existing relational tables and you want to compose
XML documents based on a certain DTD.
- You have XML documents that need to be stored with collections of data
that map well to relational tables.
- You want to create different views of your relational data using different
mapping schemes.
- You have XML documents that come from other data sources. You care
about the data but not the tags, and want to store pure data in your
database. You want the flexibility to decide whether to store the data
in some existing tables or in new tables.
- A small subset of your XML documents needs to be updated often, and update
performance is critical.
- You need to store the data of entire incoming XML documents but often only
want to retrieve a subset of them.
- Your XML documents exceed 2 gigabytes and you must decompose them.
You use the document access definition (DAD) file to associate XML data
with DB2 tables through these two access and storage methods. Figure 7 shows how the DAD specifies the access and storage
methods.
Figure 7. The DAD file maps the XML document structure to DB2 and specifies the access and storage method.
The DAD file is an important part of administrating the XML
Extender. It defines the location of key files like the DTD, and
specifies how the XML document structure relates to your DB2 data. Most
important, it defines the access and storage methods you use in your
application.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]