
root_node
element_node
Employee
attribute_node | element_node | element_node | |
Proj | |||
dept | |||
EmpNo |
| ||
|
| ||
EMPNO |
| text_node | |
|
| ||
|
| WORKDEPT | |
element_node | element_node |
| |
ProjNo | StartDate |
| |
text_node | text_node |
| |
PROJNO | EMSTDATE |
|
|
|
|
|
| element_node | |||||||||
Names of columns in DB2 tables: | Name | |||||||||||||
|
|
|
|
|
|
|
| |||||||
for example, EMPNO is a column in EMPLOYEE |
|
|
|
|
|
|
|
|
|
| ||||
table in SAMPLE database |
|
|
|
|
|
|
|
| ||||||
|
|
|
|
|
|
|
|
|
|
|
|
| ||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| element_node |
|
|
| element_node | ||||||||
|
|
| firstName |
|
|
|
| lastName | ||||||
|
| text_node |
|
|
|
| text_node |
| ||||||
|
|
|
|
|
| |||||||||
|
|
| FIRSTNAME |
|
|
|
| LASTNAME | ||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Figure 6-16 XML Collection mapping scheme
By analyzing the mapping scheme we will be able to determine whether we can compose the entire XML document with one SQL statement or not. You can use one of the two types of mapping schemes when defining a collection in the DAD file:
SQL mapping. SQL mapping uses SQL SELECT statement to define the DB2 tables and conditions used for composing a document from the collection.
RDB_node mapping. RDB_node mapping uses an
SQL mapping
Defining a DAD file with SQL mapping scheme allows direct mapping from relational data to XML documents through a single SQL statement and the XPath data model. When working with SQL mapping it is important to understand the following points:
SQL mapping scheme can be used for composition, not for decomposition.