Generating a DAD File for IBM DB2

IBM DB2 v8.1 (or higher) is a database server with an add-in for XML storage and retrieval called IBM DB2 Extender. XML data (elements, attributes) are mapped to relational data (tables, columns) through Document Access Definition files (.DAD).

There are three types of DAD files:

Storage Type

Description

Xcolumn

Column mapping - the Root element is mapped to a table, and its attributes or child elements are mapped to columns identified by an XPath

Xcollection

SQL mapping - the DAD file starts with a SQL statement for the table mapped to the Root element, and each child element or attribute is mapped to a column or a table name

Xcollection

RDB mapping - a Relational Database node, with a table and a column name, is associated with each attribute or child element of the Root element

An XML model targeted with DTD allows you to generate DAD files for IBM DB2.

  1. Map an XSM to a PDM. You can do this manually or by generating an XSM from a PDM (or a PDM from an XSM) but we recommend that you use the XML Builder Wizard (see Mapping database objects to an XML schema via the XML Builder Wizard)
  2. [if you do not use the wizard] Attach the IBM DB2 DAD extension file. To enable these extensions in your model, select Model > Extensions, click the Import tool, select the IBM DB2 DAD file (on the XML in Database tab), and click OK to attach it..
  3. Further specify the mappings with extended attributes (see DB2 Extended Attributes for Global Elements).
  4. [optional] Click the Preview tab of the Root element property sheet, and select the DB2XMLExtender.DAD File tab to preview the DAD file. If the DAD File tab is not available, click the Select Generation Targets tool to select IBM DB2 DAD in the Targets list and click OK.
  5. Generate the annotated schema (see Generating a DB2 DAD file).