DB2 9 opens the key to the XML door

Source: Internet
Author: User
Tags db2 installation

The following articles mainly describe how DB2 9 opens the door to XML, on a reputable website, I found a document about how DB2 9 opened the door to XML for you to share. The following is a detailed description of the article.

XMLXML

DB2 9 provides new XML support that can be easily used by Java application developers. This is because DB2 9 allows programmers to query, insert, update, and delete XML data and traditional SQL data using familiar JDBC statements and industry-standard query languages. In this article, I will show a detailed example of how to use Java to build an application using the DB2 "pureXML" technology. The pureXML technology allows you to store and query XML in an inherent hierarchical format of XML.

XML support for DB2

DB2 9 provides some new mechanisms for managing, storing, querying, and indexing XML data. In particular, DB2 introduces:

An XML data type that allows DB2 to store XML documents in a parsed, hierarchical format.

The new indexing technology can improve the runtime performance of cross-XML documents and query in XML documents.

Based on industry-standard query language support, including SQL's New XML extensions (commonly referred to as SQL/XML) and XQuery, which are specifically designed for XML.

Provides support for user-based mode verification of XML data, which can help administrators apply integrity constraints to XML data in DB2.

Some management functions, including the expansion of key Database Utilities.

A new feature that Java programmers are particularly interested in is DB2's new Developer Workbench, which is built on the open source code Eclipse 3.1 platform. (See the Developer Workbench article .) This integrated development environment (IDE) helps programmers quickly develop, test, and debug their database applications.

For the examples in this article, I will always use DB2 Developer Workbench. Of course, Java programmers can use any supported IDE or Java Development Kit (JDK) to create DB2 XML applications.

Set Environment

The sample code in this article references a CLIENTS table used to track customer information. Listing 1 shows the definition of this table.

Note: CLIENTS contains three columns based on the traditional SQL data type, and a new SQL data type column named "XML. The column (contactinfo) that follows stores XML documents, including information such as the customer's email address, phone number, and email address. Figure 1 shows such an XML document.

Figure 1. Example XML file stored in the CLIENTS table

I will show you how to insert this file and other information to this DB2 table. However, we will first discuss how to configure DB2 Developer Workbench.

To use DB2 Developer Workbench to compile and run DB2 XML applications, you must create a new Java project according to the standard Eclipse process, and include the appropriate DB2 database in the build path of the project. If you have never used Eclipse before, the following is a brief overview of how to complete these tasks:

Start DB2 Developer Workbench.

Create a new project. Switch to the Java Perspective (Window → Open Perspective → Java), and select File → New → Project. Specify a project name as prompted by the wizard. For other items, keep the default settings.

Add the DB2 database to the build path of the project. Right-click your project and select Properties. Select Java Build Path and click the Libraries tab. Add appropriate DB2 external. jar files, such as db2jcc. jar, db2jcc_javax.jar, and db2jcc_license_cu.jar. These files are located in the \ java subdirectory of the DB2 installation directory.

You can also create a package for the application. Right-click your project and choose New> Package.

To view details, click Help in the main menu of workbench. The above content is an introduction to open the door to XML for DB2 9. I hope you will get something.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.