Can XML Web Services Offer a Standard Across Databases?

XML is often promoted as the standard format for exchanging data. But dig into how XML is actually being implemented by the database and tools vendors, and you will often find that XML is not necessarily being delivered in the interoperable way they might expect.

by Brian C. Reed, DataDirect Technologies

t's hard to read anything these days without hearing about XML or Web services. XML is often promoted as the standard format for exchanging data, and many developers are building applications with XML to do just that. What becomes interesting is when you dig into how XML is actually being implemented by the database and tools vendors. Developers often find that XML is not necessarily being delivered in the interoperable way they might expect.

For the purpose of this article, we will focus on the role of data and XML as a key element for development. We will discuss topics that developers should consider as they approach data and database utilization with XML and even Web services. Assessing the state of the industry in terms of the role of data and XML leads to a recognition that XML is not being implemented consistently across all databases and that new technologies are emerging to help developers address this.

Database-Centric Approach to XML
Many organizations will approach building Web applications or Web services that require XML by focusing on the data that drives their business. For XML and databases, the market has consolidated into two primary categories that could be termed "RDBMS with XML" and "Native XML Database." Let's look at leading RDBMS vendors and native XML database vendors. Note that this general survey of the database market is provided for reference only to illustrate the current market issues, and is not intended as comprehensive research. Due to the rapidly evolving technologies of XML and Web services, the developer is advised to check for the latest from their database vendors.

To begin, we should note that there are three typical implementation considerations for RDBMS with XML, as shown in Diagram 1.

  • Data Types—the ability to store XML documents in the database (typically using a data type similar to a LONGVARCHAR or CLOB)
  • Mapping—tools for mapping between hierarchical XML and rectangular data stored in traditional relational database rows and columns
  • Processing—external processes and extensions to stored procedure grammar and functionality to enable processing of XML

IBM DB2
With DB2 and IBM DB2 XML Extender, IBM's approach to XML includes XML documents in the database with new XMLVARCHAR and XMLCLOB types, XML collections for XML-to-relational data mapping, and a combination of stored procedures, triggers, and user-defined functions (UDFs) for XML processing. DB2 XML Extender leverages document access definition (DAD) files for the schemas that map the hierarchical structure of XML documents to the actual relational structure in the database. In addition, DB2 can be used to create Web services that are defined by SQL statements or by a DB2 XML Extender DAD file enabled through IBM's document access definition extension (DADX). DADX files also manage database connection information using JDBC and JNDI and related XML schema, SOAP, and WSDL information for developing and deploying Web services. DB2 data is accessible through a variety of interfaces including Java, JDBC, and SOAP. (For more information, see www-3.ibm.com/software/data/db2/extenders/xmlext/index.html)

Microsoft SQL Server
Microsoft's approach with SQL Server includes the Microsoft XML SQL package and the new SQL Server Web Services Toolkit. These enable XML-to-relational data mapping and direct Web services support from the database, but Microsoft does not provide direct facilities for storing, indexing, and searching native XML documents in the database. The XML Views facility enables developers to work with SQL Server data through XPath and XQuery with XDR XML Schemas and XSD Schemas as if the database were an XML file. The OpenXML object and the new "... for XML" Transact-SQL grammar enable SQL-to-XML processing. For direct mapping via XML documents to perform updates, inserts, and deletions to a database, Microsoft also includes Updategrams. The SQL Server Web Services toolkit creates XML Web services from SQL Server stored procedures or server-side XML templates via SOAP. SQL Server data is accessible through a variety of interfaces for building Web services including HTTP via XPath and XQuery, direct SOAP support, and ADO.NET for .NET Framework developers. (For more information, see www.microsoft.com/sql/techinfo/xml/default.asp)

Oracle Oracle9i
Oracle has implemented support with Oracle9i and the Oracle XML Developer Toolkits (XDKs), enabling storage and manipulation of XML documents in the databases via the new XMLType, XML to relational mapping, and new PL/SQL procedures for XML processing. PL/SQL package extensions for SQL-to-XML processing include DBMS_XMLGEN (for queries to XML) and SYS_XMLGEN (for query arguments to XML). The XML SQL utility generates Java XML documents, DTDs, and schemas from SQL queries. The XSQL Servlet combines XML, SQL, and XSLT in the server at runtime to deliver dynamic Web content. For Web services, SOAP-based interfaces are provided through Oracle SOAP. Oracle XDKs are available for a variety of development environments including Java, C/C++, and PL/SQL with access interfaces including Oracle OCI extensions, HTTP XPath, SOAP, and JDBC. (For more information, see http://otn.oracle.com/tech/xml/xdkhome.html)

Native XML Databases
Native XML Databases focus on storing, reading, writing, and maintaining data and documents in a native XML format, as shown in Diagram 2. Most XML databases provide their own proprietary tools and interfaces for accessing and manipulating their systems as well as standard interfaces and technologies such as HTTP XPath/XQuery, SOAP, ODBC, JDBC, and more. One advantage of native XML databases is that developers can interoperate exclusively in the XML domain and leverage the latest XML features and optimizations, although these systems may not have all the "burned in" enterprise features of relational databases. Most XML databases include tools for integrating or migrating, and other types of data such as relational data. Vendors in this category include SoftwareAG, eXcelon, and Ipedo. (For more information, see
www.softwareag.com/tamino/, www.exceloncorp.com/products/XIS/, and www.ipedo.com/html/products_xml_dat.html)

Emerging APIs and Components for XML
As we have explored database-centric approaches, one thing is clear: There are many different ways to use data with XML. This clearly points to the need for a more consistent approach for building applications and Web services that use XML and database data.

In fact, there are emerging technologies that take the combined elements of the other approaches to enable easier interoperability between existing relational data and XML formats regardless of the backend data store, as shown in Diagram 3.

These software components and tools, for example, use SQL, XML, and environments such as Java to help developers build applications that insulate them from all the variations of database and XML implementations. Interfaces provide traditional SQL grammar extended with key XML constructs to enable the application to seamlessly move between XML and SQL database formats with full SQL support including SELECT, INSERT, UPDATE, DELETE.

The opportunity for success lies in their independence of database or platform, combined with leveraging other standards including DOM, SAX, JDOM, W3C schemas, DTDs, XPath, XQuery, JDBC, ODBC, and so on. Developers choose technologies like Java and XML for portability, but quickly find that the XML-to-database portability only goes so far.

One way to tackle this problem is with software that can dynamically transform data between XML and relational databases for JDBC applications. This can contribute to faster and easier development of Java applications that require both relational data and XML support by enabling consistent functionality, performance, and reliability of the XML support across major relational data platforms. Let's look at an example of how SQL and XML can work with these technologies.

Sample SQL 92 Query


SELECT EmployeeID, FirstName, LastName, Title, HireDate, Salary 
   FROM Employees e
   WHERE HireDate >= {d '2000-01-01'}

Sample SQL Tabular Data
EmployeeID FirstName LastName Title HireDate Salary
456321 Jane Smith Director 2000-01-01 120000
456322 Roger Jones Sales Rep 2000-02-01 80000

Sample Resulting XML SQL Query

xml_document(
   xml_element('result',
      SELECT
         xml_element('Employees_Info',
            xml_attribute('ID', e.EmployeeID),
            xml_element('name',
               xml_element('first', e.FirstName),
               xml_element('last', e.LastName) ),
            xml_element('title', e.Title),
         xml_element('hiredate', e.HireDate),
         xml_element('salary', e.Salary) )
      FROM Employees e WHERE e.HireDate >= {d '2000-01-01'}
   )

Sample Resulting XML data

<?xml version="1.0" encoding="UTF-8" ?>
<result>
   <Employees_Info ID='456321'>
      <name>
         <first>Jane</first>
         <last>Smith</last>
      </name>
      <title>Director</title>
      <hiredate>2000-01-01</hiredate>
      <salary>120000</salary>
   </Employees_Info>
   <Employees_Info ID='456322'>
      <name>
         <first>Roger</first>
         <last>Jones</last>
      </name>
      <title>Sales Rep</title>
      <hiredate>2000-02-01</hiredate>
   <salary>80000</salary>
   </Employees_Info>
</result>

The reality is that trillions of bytes of corporate data are stored in existing relational and legacy databases—and will continue to reside there. Developers are therefore looking for ways to better utilize that data with XML. XML will likely become the common way for developers to build applications that share and transmit data, while SQL RDBMS will continue to be focused on storage. As we have seen, developers have a variety of interfaces and tools at their disposal to interoperate between database data and XML data to build new types of applications and Web services. Some offer more consistent functionality across databases, while others are designed for a specific database strategy and vendor architecture. The industry will evolve and consolidate around a handful of best-of-breed.



Copyright © 2002 DataDirect, Inc. Reprinted with permission.





FEATURE SOFTWARE:
SQLDC
Create SQL applications quickly and easily.
Buy Now!

FEATURE BOOK:
VBCommander
Speed app and component design time with this set of more than 20 add-in tools.
Buy Now!




 
Sponsored Links

Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map
Jupiterweb networks

internet.comearthweb.comDevx.comClickZ

Search Jupiterweb:

Jupitermedia Corporation has four divisions:
JupiterWeb, JupiterResearch, JupiterEvents, and JupiterImages

Copyright 2004 Jupitermedia Corporation All Rights Reserved.
Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Jupitermedia Corporate Info | Newsletters | Tech Jobs | E-mail Offers

Copyright Information/Privacy Statement