Compare the XML functions in DB2 9 and DB2 V8.x

Source: Internet
Author: User
Tags xslt xquery

The db2 tutorial is to compare the XML functions in DB2 9 and DB2 V8.x.

Introduction
XML in DB2 UDB Version 8.x supports the relational infrastructure based on DB2. XML data is either stored as a big character object (CLOB) as is, or decomposed into Relational Tables. On the other hand, DB2 UDB Viper supports real XML data locally. Now, XML data is processed as a new data type and stored in a parsed and annotated tree, which is separated from relational data storage. XML indexing technology based on the XML mode is introduced, and XQuery and SQL/XML are supported as the languages for querying and publishing XML data.

XML support in DB2 UDB Version 8.x

DB2 8.x uses SQL/XML and DB2 XML Extender to provide XML functions for underlying relational data. DB2 XML Extender provides many user-defined types (UDT), user-defined functions (udfs), and stored procedures to support XML. The XML document is stored as a link and uses the XML Extender infrastructure to provide an XML Representation of the link data. Some SQL/XML functions are also supported to publish relational data as XML. For more details, refer to the DB2 XML Extender Web site.

DB2 also allows you to create user-defined Java functions and stored procedures and merge XML and XSL Parser (installed as part of DB2 8.x) into the code.

XML support in DB2 Viper

DB2 Viper supports local XML storage, so you no longer need to break down XML into Relational Tables for query and publishing. This new storage method saves XML as a tree that is parsed and annotated similar to the XML Document Object Model (DOM. For applications that still need to break down XML data into Relational Tables, this version also provides an enhanced decomposition function, which uses XML Schema ing with annotations.

XML feature comparison-DB2 UDB Version 8.x and DB2 Viper

Table 1. XML feature comparison-DB2 UDB Version 8.x and DB2 Viper



DB2 UDB Version 8.x DB2 Viper storage and Indexing

XML data is stored in two forms:

Original document:

  • XML Extender columns of the XMLCLOB, XMLVARCHAR, and XMLFILE types.
  • BLOB, CLOB, or VARCHAR columns.
  • Create an indirect index for the XML document in the relational subtable.
  • Parse the document to update the created sub-table.
Break down to the relational XML Extender (XML set ):
  • Use the document access definition (DAD) to break down existing Relational Tables.
  • Only leaf nodes in XML can be decomposed and mapped to the SQL column type.
  • Namespace is not supported.
  • It has limited functions and cannot process complicated XML documents.
XML data is stored in two forms:

Original Local Document XML storage.
  • A new hierarchical (local) storage is built from the ground up. This storage method saves any tree form of the document.
  • XML columns.
  • Create an XML index using the path expression of the leaf node.
  • Parses the document during insertion.
Use relational SQL/XML Functions and annotated mode ing for decomposition.
  • Use the XML schema ing with annotations to break down existing Relational Tables.
  • XML fragments can also be decomposed and mapped to the XML column type.
  • Process the namespace.
  • You can use extended functions to filter XML data, such as DB2 expressions and conditions.
Verify
  • Implicit verification defined in DAD.
  • Use XML Extender UDF svalidate for explicit verification.
  • Document Type Definition (DTD) is registered and stored in internal tables.
  • Obtain the XML schema from the file system.
  • No implicit validation associated with the column.
  • Use the SQL/XML function XMLVALIDATE for explicit verification.
  • DTD verification is not supported.
  • The DTD and XML modes are registered in the XML schema repository (XSR) and stored in the database.
Query and release

Use SQL/XML and XML Extender functions for query and release.

For the original XML document.
  • Query a document using an indexed sub-table and obtain the document in CLOB format.
  • You can use the XML Extender function to query sub-documents.
You can use the Extender function to perform XSLT conversion.

For XML data that is decomposed into Relational Tables.
  • SQL/XML publishing functions.
  • XML Extender DAD ing and functions.
Use SQL/XML and XQuery for query and release.

For the original XML document.
  • You can use SQL/XML and XQuery in combination to retrieve and publish relational data and XML data.
  • Multiple XML columns can be joined.
The XML Extender XSLT function supports XSLT.
  • You can use XQuery to query, convert, and publish XML files.
For XML data that is decomposed into Relational Tables.
  • SQL/XML publishing functions.
Update the XML document.
  • Use the SQL update statement to update all documents.
  • Update with XML Extender UDF update.
For the original XML document.
  • Use the SQL update statement to update all documents.
  • The update of sub-documents is not supported due to the lack of criteria for defining XQuery updates.
  • You can download the update stored procedure from developerWorks. For details, refer to XML application migration from DB2 8.x to DB2 Viper, Part 1: Partial updates to XML documents ENTs in DB2 Viper (developerWorks, May 2006 ).
To enable the XML function for a database, you must enable the XML Extender function for the database. You do not need to enable the database because XML support is now an inherent part of the DB2 engine. The tool does not integrate XML support in the DB2 Development Center or Control Center.

Websphere Studio Application Developer
  • XML Schema Editor
  • DTD Editor
  • DAD Mapping tool
  • SQL XML is not supported in the Query Builder.
  • Xerces and Xalan parser
  • Java Database Connectivity (JDBC) drivers are not supported.
XML supports integration into all aspects of the tool.

DB2 Control Center and DB2 Develope

[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] Next

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.