Before you start
This tutorial takes you through the process of setting up IBM WebSphere Application Server Community Edition software (hereafter referred to as Community Edition) and an IBM DB2 9 database on a Linux or Microsoft® Windows environment. You'll also see what's involved in writing and deploying Java 2 Platform, Enterprise Edition (J2EE) applications that run on Community Edition. You will learn to take advantage of the DB2 9 pureXML technology to store XML in its native format, and to use Community Edition to serve J2EE applications.
DB2 9 is the industry's first hybrid data server for managing data in both relational and pure XML formats. DB2 has long provided high-performance data storage and access for relational data based on SQL standards, along with 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 its existing relational engine. Application developers can now store XML data directly inside of 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 interapplication 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 traditionally been quite limited. Recently, a new standards-based XML query language has been published. This query language is known as XQuery; version 1.0, was released in November 2005. It is an extension of existing XPath 2.0 standard. See Resources for more about XQuery and XPath.
IBM WebSphere Application Server Community Edition is a J2EE application server built on top of Apache Geronimo, an open source application server created by the Apache Software Foundation. If you need a lightweight application server as a test platform to run your J2EE applications and would prefer to have a build that is relatively stable, well-tested, and available with world-class support, then Community Edition is your best choice, both technically and economically. You can be confident that you are using an application server that is stable enough to run your applications and prototypes; plus, Community Edition is free to download and use. You can install it and get it running quickly and then get on with the business of evaluating or demonstrating your prototypes. You can continue to use the product at no cost, purchase optional IBM support as needed, or even migrate to other WebSphere Application Server products if you desire.
This tutorial will help familiarize you with Community Edition administration, and with writing Java code that uses and stores XML in DB2 9. You will perform the following tasks:
- Install required software.
- Set up a DB2 9 database and configure Community Edition to use DB2 9.
- Deploy a data source to Community Edition for connection pooling.
- Deploy a sample J2EE application to Community Edition.
- Analyze the Java code for the sample application and understand how it works.
This tutorial is written for application developers who have at least introductory experience with DB2 9, some experience with SQL and the Java platform, and some knowledge of XML.
To run the examples in this tutorial, you need:
- DB2 9 Data Server
- WebSphere Application Server Community Edition
- Apache Ant
- Microsoft Windows 2000 or higher and an account with administrator privileges, or Linux and an account with root access. Make sure Java Runtime Environment 1.4.2 or higher is installed on your system.
See the developerWorks tutorial "DB2 XML evaluation guide" (see Resources) for steps on installing DB2 9. DB2 9 will automatically start after installation. Also, refer to the "Download and install Community Edition" section of the developerWorks article "Get started with WebSphere Application Server Community Edition" (see Resources) to see how to download the install bundle appropriate for your platform and install Community Edition.
Apache Ant is an open source, Java-based build tool. You can find information on installing Apache Ant on the project's home page.
You also need to download the sample J2EE application that is used to demonstrate the concepts in this tutorial. The code and required data for this application are in the file j2ee_development_db2.zip. Extract the contents of j2ee_development_db2.zip to a directory such as C:\j2ee_development_db2 or /home/userid/j2ee_development_db2. This directory is referred to simply as j2ee_development_db2 throughout the tutorial. This tutorial assumes you used the default directories when installing DB2 9 and Community Edition.