Before you start
The DB2 Viper data server provides many new capabilities including: flexible security options, data storage optimization, and improved support for storing, managing, and querying XML data. DB2 is designed to optimize access to XML and relational data and these capabilities are available to C++, .NET®, COBOL, Java™, and PHP application developers. DB2 Viper is now available (for evaluation purposes) and this tutorial can be used to aid in understanding how to use XML and SQL together to build the basis of a flexible scheduling application.
The DB2 XML Evaluation Guide is a step-by-step tutorial to introduce the reader to the DB2 Viper data server on Windows platforms using the XML storage and searching (SQL/XML, XQuery) capabilities available to support next-generation applications.
DB2 Viper is the industry's first hybrid data server for managing data from both relational and pure XML formats. DB2 has been providing high-performance data storage and access for relational data based on SQL standards and data storage optimizations such as data partitioning and advanced indexing and query optimization techniques. Now, DB2 has introduced an optimized data storage engine for XML data alongside the existing relational engine.
Application developers can now store XML data directly inside a DB2 server and reap the benefits of transactions, advanced data resiliency, secure access, and, of course, the ability to search large amounts of XML data using XQuery.
XML data is often used for inter-application data exchange and document management purposes. The flexible and self-describing nature of XML data makes it ideal for many application scenarios.
The ability to query XML data has been quite limited. Recently, a new standards-based XML query language has been published. This query language is known as XQuery Version 1.0.
XQuery Version 1.0 was released in November 2005 and it is an extension of the existing XPath Version 2.0 standard. See Resources for Web sites to read more about XQuery and XPath.
This tutorial will help familiarize you with DB2's new support for XML data. You will perform the following tasks:
- Create a DB2 Viper database (to support relational and XML data objects).
- Create a DB2 table to store XML data.
- Add data to the table using SQL INSERT statements.
- Query a table using SQL and XQuery.
- Adding additional data into DB2 tables using the DB2 IMPORT utility.
- Issue various queries using XQuery.
- Querying using XQuery on a XML column of an indexed table.
- Create and test a view for simplified data access.
This tutorial is written for database administrators who have limited experience with DB2 Viper and have some experience with SQL and some knowledge of XML.
To run the examples in this tutorial, you need a Windows 2000 or higher machine with an account having administrator privileges.



