an xml enablement of db2 - db2 xml extender.pdf

Upload: vishalbvp

Post on 01-Jun-2018

246 views

Category:

Documents


1 download

TRANSCRIPT

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    1/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    An XML Enablement of DB2

    -- DB2 XML Extender

    Jane Xu and Josephine Cheng

    Database Technology Institute,

    Silicon Valley Lab, IBM

    [email protected]

    Manfred Pler

    IBM Datamanagement

    [email protected]

    1

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    2/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Agenda

    XML and DB2

    XML Extender Overview

    Storage and Access of XML DocumentsXML Processing of Relational Data

    Other Features

    Conclusions

    2

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    3/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    XML and DB2

    3

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    4/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    XML brings data to the web, completing thenecessary components for 90%+ of

    e-business applications.

    Universal Communication - Internet

    Universal User Interface - Browsers

    Universal Programming - Java

    and now...

    Universal Information - XML

    XML completes the puzzle

    4

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    5/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Putting DB2's Power to Support XML

    DB2 provides stability, scalability, and security

    Your mission-critical business data is currently

    stored in DB2DB2's XML support adds its power to enable yourbusiness data for XML

    With DB2's XML support, you can makeapplications to:

    Store XML documents for fast search

    Compose or decompose XML documents from or

    into relational tablesQuery XML data based on XPath expressions

    You can build B2B and B2C applications on topof DB2 using XML Extender as the SDK

    5

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    6/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    XML Extender Overview

    6

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    7/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    XML Extender Overview

    DB2

    XML

    DOC

    DB2 XML

    Extender

    File System

    XML

    FilesDAD

    (Data Access

    Definition)

    Application

    Program

    7

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    8/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Two Access and Storage Methods

    DB2 XML

    Extender

    DAD(Data Access

    Definition)

    DB2 UDB

    Application

    XMLColumn

    book

    user table

    XMLCollection

    XML

    DOC

    8

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    9/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Storedprocedures

    UDFs

    Admin

    GUI

    AdminCommand

    DB2

    CAE

    Client

    XMLParser

    Utilities

    XML ExtenderServer

    XML ExtenderClient

    DB2

    Server

    Server

    XML Extender Components

    9

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    10/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    DAD:Data Access Definition

    XML document itself

    Define the mapping between XML document and

    relational tablesUsed for both XML Column and XML Collection

    XPath Standard:

    XPath:

    part of the XSLT, as W3C recommendation

    A subset of the abbreviated location paths is usedto identify XML element or attribute

    The data model is used in XML collection mapping.

    10

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    11/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Storage and Access of XML

    Documents

    11

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    12/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    UDT (DB2 User Defined Type):

    XMLFile - external file name

    XMLVarchar - for internal short document

    XMLCLOB - for internal long documentUDF (DB2 User Defined Function):

    Import/Storage

    Retrieval

    Update

    Extract:

    Extract XML element/attribute values fromdocuments

    Convert characters in XML documents into generalSQL data types

    Provide both scalar and table UDFs for each datatype

    XML Column Storage and Access

    12

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    13/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Select

    db2xml.extractDouble(order,'/Order/Part/ExtendedPrice')from order_tab where invoice_number = 356

    ......

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    14/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Thompson .... ....

    DAD

    (Data Access

    Definition)

    part_tab

    part_key ....

    82 ....

    order_tab

    order_key customer

    99 Thompson

    83 ....

    Order

    (XMLCLOB)... ...

    ... ...

    Sales_tabside tables

    Using Side Tables for Fast Searches inXML Documents

    14

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    15/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Use Text Extender on Structural TextSearch

    XML column or decomposed column in tables can beenabled with Text Extender

    Use Text Extender section support of structural textsearch in query

    Example:

    SELECT order FROM sales_tableWHERE CONTAINS(orderHandle,'MODEL order SECTION(/Order/Customer)"John Doe" ') = 1

    No dependency on Text Extender if searching on SQLdata types of XML element/attribute values is sufficient

    15

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    16/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    XML Processing of

    Relational Data

    16

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    17/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Document/Database Mapping with DAD

    Thompson .... ....

    part_tab

    part_key ....

    82 ....

    order_tab

    order_key customer

    99 Thompson

    DAD

    (Data Access

    Definition)

    83 ....

    order_key

    99

    99

    Mapping Methods:SQL (compostion only)

    RDB_node (XML-Style for

    compostion/decomposition)

    17

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    18/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Two Mapping Schemes

    SQL mapping (composition only)

    SQL syntax

    specify the SQL select statementspecify the mapping between column and XML datain attribute_node and text_node

    certain restrictions apply

    RDB_node mapping (comp. & decomp.)XML syntax

    specify tables and relationship among tables in theRDB_node of the root element_node

    specify RDB_node with table name, column nameand optional condition for attribute_node andtext_node

    18

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    19/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Dynamic Mapping

    Ability to take DAD to generate or shred XMLdocuments, where DAD can be created byapplications on the fly.

    Change query criteria by overriding query condition

    for document generationSQL_OVERRIDE:

    replace the SQL query

    change conditions in the WHERE clause

    designed for DBMS experts

    XML_OVERRIDE:

    Use XPath syntax to define element or attribute,

    Specify the constraints on XML elements orattributes on the documents to be generated

    An example:

    /department/@id = 'E01' AND

    /department/name = 'John Duo'

    19

    U St d P d t P

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    20/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Use Stored Procedures to ProcessXML Collections

    Decompose XML documents into new or existingtables

    Compose XML documents from existing data ordecomposed XML documents

    Specify override type and value for dynamicmapping

    20

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    21/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Other Features

    21

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    22/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Other Features

    DTD Repository

    Store your DTDs in DB2

    One DTD can be referenced by many XML

    documents and more than one XML column andXML collection.

    Use DTDID to validate input XML documents atthe insertion time

    Validating Input or Generated XML DocumentsValidation can be specified in your DAD,

    Supported in both XML Column and Collectionfeatures

    GUI based Administration Tool

    Help enabling your database, tables, columns,and collections for XML

    Help creating DADs

    22

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    23/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Conclusions

    23

    U i F t f DB2 XML E t d

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    24/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Unique Features of DB2 XML Extender

    In XML ColumnXPath based queries on individual documentsusing extracting UDFs

    Use XPath data model to map XML structure to

    relational tablesXPath based element/attribute update

    Providing Sequence number to identify multipleoccurred XML document element or attribute

    In XML CollectionDirect mapping from relational to your target XMLdocument structure, for high volume B2Bapplications

    Dynamically generate XML documents from DB2data, and change query criteria via overridingquery conditions

    Decompose XML documents and storing

    un-tagged data into DB2 tables

    24

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    25/26

    NET.OBJETDAYS 2000October 10-12, 2000Xu and Cheng, Pler

    Validate input or generated XML documents againstDTDs

    Integrated with DB2 Net.Data for Web applicationsWrite your applications with the interface ofembedded SQL, ODBC, JDBC, or SQLJ

    Integrate XML technology with traditional relational

    dataIntegrated with DB2 UDB package

    For Your e-business Applications

    25

  • 8/9/2019 An XML Enablement of DB2 - DB2 XML extender.pdf

    26/26