IBM DB2 Tools
DB2 is IBM's flagship relational database management system, and IBM DB2 tools in Stylus Studio® can significanly simplify and automate many tasks involving DB2 and XML. It's no surprise that Stylus Studio® and IBM DB2 should complement each other. Stylus Studio and IBM have been leading contributors to open-source projects such as those under the Apache Foundation, and both have pushed hard for open standards. Here are just some of the highlights of the many DB2 Tools in Stylus Studio® for working with relational and XML data:
Stylus Studio® fully supports DataDirect XQuery™ (an industry-leading XQuery processor), which you can use to query IBM DB2 with XQuery. The power of DataDirect XQuery™ comes to light when you realize that because both IBM DB2 and Stylus Studio® fully support the standard, Stylus Studio® can be used to edit and debug XQuery that will later be used in a production IBM DB2 environment.
Going further, while IBM DB2 alone allows you to merge XML and relational sources, Stylus Studio® allows you to merge in non-XML sources of data as well — including EDI and other legacy data formats, through integrated support for DataDirect XML Converters™.
Using the File Explorer, it's straight-forward to add a new reference to an IBM DB2 database. Right-click on Relational DB and pick New Server. Then fill in the dialog with the connection details, like this:
Once done, you drag and drop your connections onto the editing area to define a new collection. The setup for this demonstration uses an IBM DB2 server running on a machine named stylus (as far as this tutorial is concerned, either DB2 8 UDB or DB2 9 (Viper) behaves the same.)
(click to enlarge)
The way that XQuery against a relational database works is that the query is decomposed and reformulated in the specific SQL dialect of the underlying engine. Since DB2 supports XQuery natively, how is this an advantage? There are several:
DataDirect works hand-in-hand with database vendors including IBM to understand the details of query optimization, and the drivers are continually update to take advantage of new server-side changes and new client-side optimization strategies.
What you write is standard XQuery, but what IBM DB2 receives is the IBM DB2 dialect of SQL. This means what you put together never has to stoop to vendor-specific slang, but can remain pure — and more importantly, portable (IBM is proud of its pureXML concepts, and we whole-heartedly support those same ideals in our tools.)
This also helps in planning for the future. When it comes time to reevaluate your database decision, whether the choice is to upgrade to DB2 10 (or whatever it may be called) or to switch databases, you are shielded from underlying changes in syntax. Your application can remain untouched, and the drivers we supply will mask any differences in the underlying database engine implementation.
Since the XQuery is initiated from the client, other actions can be taken whose realm is outside that of the database. For example:
Publishing. Once you've connected to the database, it is a simple matter to use this database for XML reporting or publishing, as you'll see shortly.
Pipelines. XQuery doesn't have to stand alone; they can also be embedded in XML Pipelines for multi-stage transformation and output generation.
Just dragging the from the File Explorer to the XML Report data sources pane makes it available for use in publishing from XML.
The XML Report module lets you draw your output on the screen, and then builds XSLT 1.0, XSLT 2.0 or XQuery 1.0 that will in turn output HTML+CSS or XSL-FO. You can then use that generated program code in your own applications, or as part of an XML Pipeline to accomplish elaborate operations.
By no means is this the end, but we've just taken you on a tour of some of the highlights as to how IBM DB2 can be used more effectively with Stylus Studio® for both developing XQuery and also manipulating the XML and relational data stored within it. We hope you'll take the opportunity to download and evaluate our award winning DB2 tools Stylus Studio® today!