N. America: 800 876 3101 | World: 44 (0) 1753 218 930

DataDirect XQuery Support for IBM DB2

IBM DB2 databases are best supported by the DataDirect XQuery processor. DataDirect XQuery allows you to query relational tables in the same way as XML documents, making it easy to publish both relational and XML data as XML. DataDirect XQuery is particularly useful for XML publishing and reporting, and for data integration. DataDirect XQuery runs on any Java platform, and is easily embeddable into almost any Java program. DataDirect XQuery works with any J2EE Application Server, although no application server is required.


Following are just some of the reasons why DataDirect XQuery is the best XQuery processor for querying relational data stored in IBM DB2 databases.

Efficient Query Execution

Relational databases often hold massive amounts of data, so DataDirect XQuery uses a very efficient way to query them — but hides this from the query author. Using DataDirect XQuery:

  • To the XQuery query, a table looks like an XML document
  • To the relational database, an XQuery looks like efficient SQL

Data is not extracted in order to query it; instead, DataDirect XQuery generates SQL and executes that SQL on the server, enabling you to retrieve just the data needed to construct the results for a given XQuery.

SQL Optimizations

One key advantage of DataDirect XQuery over other XQuery processors is that it decomposes your XQuery and translates it to SQL. The benefits of such a translation, of course, are enormous, especially in terms of the performance and efficiency with which your XQuery applications will run. Once converted to SQL, the query is pushed to the database server and executed there. In the database environment, the SQL is able to take advantages of your database's indexes and primary key/foreign key relationships, speeding data access and retrieval.

Other XQuery processors are unable to convert XQuery to SQL, leaving them with no choice but to fetch the entire table from the relational database and return it to the client side, where it is then converted, in its entirety, to XML. This might work fine with trivial queries or very small relational tables, but it is not an approach that scales, or even one that offers reasonable performance for real-world data integration and aggregation.

XML Optimizations

Query results are returned to DataDirect XQuery as tabular data, which is then easily converted to XML. Once converted to XML, DataDirect XQuery uses data streaming and document projection technologies to focus on only those elements and attributes that are relevant to the query, minimizing in-memory processing. This approach allows for fast and efficient processing of very large XML documents (1 gigabyte and larger!). Relational joins and other complex query structures pose no problem for the DataDirect XQuery processor.

Easy Database Connectivity

Configuring and connecting to a IBM DB2 server is easy. You can use an XML IDE like DataDirect's Stylus Studio to quickly define server configurations and connect to that server, using a simple dialog box like the one shown here:

And it's easy to create and reuse default database connections, too.

Even without an XML IDE like Stylus Studio, defining IBM DB2 database connections is easily accomplished using the XQuery API for Java (XQJ), whose interfaces are implemented by DataDirect XQuery. You simply need to define data source and connection expressions, like the ones shown in the following code sample, in your Java application, and you're all set.

Transparent Access to Relational Data as XML

Once you have connected to a relational data source, Stylus Studio and the Editor for Eclipse makes it easy for you to automatically create XQuery code. Using Stylus Studio, for example, you just drag and drop a table from the File Explorer window, exposing all the tables from that tablespace as potential data sources. Next, drag the table you want to query and drop it on the XQuery Source tab — Stylus Studio automatically creates perfect XQuery code based on the table you choose. These easy steps are summarized in the following illustration.

And when you're done building and testing your XQuery code, you can quickly generate Java code that you can embed in a Java application.

IBM DB2 Version Support

For the most recent version support, please view the XQuery Support Matrix.

Support for Other Relational Databases

DataDirect XQuery also provides support for the following relational databases:

Support for Other Non-XML Data Sources

DataDirect XQuery also provides support for non-XML sources like these:

Supported Databases
(Table of Contents)

XQuery Support Matrix

Need to know if a specific database version is supported??

Check out the DataDirect XQuery Support Matrix. The Matrix provides up-to-date information on all of our supported databases.

Use DataDirect XQuery to Mine IBM DB2 Data!

This informative XQuery webinar shows you how scalable, flexible, and reliable DataDirect XQuery is for building XML applications that access data from IBM DB2, XML, Web services and legacy formats; and how it uses document projection and data streaming technologies to efficiently query large (Gigabytes) XML documents.

Check our XQuery Webinars page for more information on this and other Webinar topics.

IBM DB2 Support in DataDirect XQuery Now!

DataDirect XQuery is now released!

DataDirect XQuery supports the XQuery Candidate Recommendation with enhanced performance and scalability, support for very large XML files, XML adaptors for flat file and EDI formats, IBM DB2 databases, and more.

Download now!

DataDirect XQuery FAQ

This informative DataDirect XQuery FAQ answers frequently-asked questions about DataDirect XQuery, including questions about performance, scalability, use-cases, resources, and more.

If you're more of a hands-on learner, then download a free copy and start exploring DataDirect XQuery today!