Oracle Database can read and write to WebDAV (Web Distributed Authoring and Versioning) repositories, giving users a nice
Web folder view of the XML data they can request. The WebDAV support allows administrators to set up access to thousands upon
thousands of XML files without requiring much disk space. This is because these WebDAV files, though they appear to be regular
XML files, are just shortcuts, queries that point back to the database. The data that comprise these files doesn't materialize
until it's requested by opening the file or copying it to a different location. Along with WebDAV, Oracle also supports transferring
XML documents across FTP and HTTP.
Perhaps the most important improvement in Database 10g is XML schema evolution. Schema evolution allows you to implement changes
to XML schema by mapping the existing data to the new schema. Instead of having to export and re-import all of your XML data,
you just create the XSLT (XSL Transformation) style sheet to transform your old documents to the new schema, and the database
takes care of the rest. Schema evolution greatly eases the management of XML data, because one thing administrators can count
on is constantly changing requirements.
Oracle Database 10g offers some superb options for storing XML data. The XMLType data type obscures much of the complexity
of storing and querying XML data, allowing admins to manipulate the data using familiar SQL tools and concepts. For instance,
you can create an XMLType table or an XMLType column in a relational table. Creating an XMLType table is how you implement
the structured storage method and preserve your XML hierarchy. Creating an XMLType column in a relational table is how you
implement the unstructured storage method, which is useful for storing entire XML documents for attachment to relational records.
And what can be done with a table can be done with a view. You can also use these tables and views in stored procedures and
process data based on them, so there are some very advanced possibilities here.
How easy is managing XML data in Oracle? Assuming you already understand all things XML, including SQL/XML, XQuery, and DTD
(Document Type Definition), XML processes in Oracle Database are very easy to manage. In fact, as in schema evolution, the
database handles many data management processes on its own, with a minimum of admin intervention.
In my speed tests, which involved importing thousands of files, creating thousands of files, and importing very large documents,
Database 10g proved very fast, beating all comers at imports and finishing a close second to IBM in the file-creation test.
Big Blue, B Student
IBM is on the ball, too. DB2 implements XML as a collection of options called the XML Extender. Another key piece, the Information
Integrator, is licensed separately from DB2. Although the XML Extender may sound like a separate program that sits outside
the database and interacts with the relational engine, it is in fact just a collective name for the stored procedures and
functions that provide the XML functionality inside DB2. These stored procedures and functions sit inside the relational engine
like any other objects in the database and are accessible to any user who needs them. It's only slightly annoying that there's
a separate install to get the Information Integrator functionality.
The Information Integrator sits outside the relational engine and extends the functionality of XML in DB2 by adding the XML
Wrapper, which allows you to treat XML documents as relational sources. The XML Wrapper is a very powerful tool that could
be useful in receiving transmitted XML files that you want to be able to query and possibly report on, but which you don't
want to import into the database.
Like Oracle Database, DB2 allows you to store structured XML, unstructured documents, or shredded data. And like Oracle's
XMLType, DB2's XML datatype allows you to obscure the details of XML data storage from both users and admins alike. Views
can be created to merge relational data with XML data in a single result set. This same result set can be merged with XML
documents on the file system or with other XML or relational data inside the database.
DB2 uses SQL/XML as the main language for creating XML documents from relational data; you use SQL/XML functions to create
XML tags, attributes, and the like. SQL/XML also allows you to perform concatenations and aggregations while creating the
document. DB2's SQL/XML support isn't complete, but it covers the major functions. If you are using DB2 today, you'll probably
be able to do anything you want when creating XML documents.
XQuery, on the other hand, is completely unsupported by DB2. No doubt IBM is waiting for the W3C to solidify the specification
before it implements the unfinished standard. Nevertheless, the absence of XQuery imposes significant limitations on DB2's
XML search capabilities. I would much prefer to see a partial implementation than for it to be completely left out.
XQuery, which is a language used for crawling through structured data paths, offers significant query functionality beyond
what SQL can do. Because XQuery is an identity-based query language, whereas SQL is value-based, you can use XQuery to find
out whether a certain element exists; SQL can tell you whether an element that's known to exist holds a certain value. Unlike
SQL, XQuery also has knowledge of attributes inside element tags, and it has stronger data types than SQL, providing you greater
control over the type of data being written or queried.
XQuery notwithstanding, IBM's commitment to XML is quite apparent when you look at the improvements it has made in DB2 V8.1.
Not only does V8.1 support XSLT for on-the-fly translation of XML data, there are more than 1,000 changes to SQL syntax for
handling XML alone.
How easy is DB2's XML to manage? Very. The views manage the dynamic data underneath them and provide a layer of abstraction
that clients need in order to query the database effectively. However, updating your XML schema will be a hassle. Because
DB2 doesn't support schema evolution, you will have to physically map your old data to any new schema produced by changing
requirements.