Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

DB2 9 Application Developer Certification Exam 733 prep, Part 3: XML data manipulation

Store and retrieve XML through your application

Donald E. Payne (payned@us.ibm.com), Advisory IT Specialist, IBM
Donald Payne
Donald Payne is an Advisory IT Specialist with IBM. He has consulted for customers and taught computer classes on relational databases and extensibility. He first worked with XML in 2001. He has assisted early customers using the pureXML features of DB2 V9.

Summary:  Learn how IBM® DB2® parses XML, handles whitespace, and serializes XML, and see how document encoding and client data type affect parsing and serialization. Learn, also, how DB2 validates XML against an XML schema as well as how to use SQL/XML functions to "shred" XML to relational data, assemble relational into XML, and publish XML as relational data.

View more content in this series

Date:  16 Mar 2007
Level:  Intermediate PDF:  A4 and Letter (163 KB | 51 pages)Get Adobe® Reader®

Activity:  12306 views
Comments:  

Before you start

About this series

The IBM Certified Application Developer certification confirms to others that you are an intermediate- or advanced-level IBM DB2 for Linux®, UNIX®, and Windows® application developer and shows that you have strong skills in all common programming tasks as well as embedded SQL programming, ODBC/CLI programming, .NET programming, or Java™ programming.

This series of nine free tutorials is designed to help you prepare for the DB2 9 Application Development for Linux, UNIX, and Windows certification exam (Exam 733). Each tutorial includes a link to a free DB2 9 for Linux, UNIX, and Windows trial download. These tutorials provide a solid base for each section of the exam. However, you should not rely on these tutorials as your only preparation for the exam.


What is this tutorial about?

This tutorial teaches you how DB2 and a DB2 client application manipulate XML data. You'll learn:

  • How DB2 handles whitespace on input
  • How DB2 determines the encoding of an XML document on input and output
  • How DB2 can validate XML on input
  • How to execute an XQuery or XPath and identify its results
  • How to decompose, or shred, XML input to relational rows
  • How to publish relational data as XML
  • How to publish XML data as relational

This is the third in a series of nine tutorials that is designed to help you prepare for the DB2 9 Application Developer Certification exam (Exam 733). The material in this tutorial covers the objectives in Section 3 of the exam, titled "XML data manipulation."


Objectives

After completing this tutorial, you should be able to write applications that store and retrieve XML.

Prerequisites

This tutorial is written for DB2 developers who are familiar with the following concepts:

  • XML, including:
    • Elements
    • Attributes
    • Documents
    • Well-formed documents
    • XML declarations
    • Namespaces
  • XPath, including the XML Data Model (XDM):
    • Nodes
    • Atomic values
    • Items
    • Sequences
    • Axis: Parent, child, descendant, and so on
    • Steps
    • Wild cards
    • Predicates
  • XQuery:
    • The db2-fn functions xmlcolumn(), sqlquery()
    • FLWOR expression: for, let, where, order by, return
    • prolog
  • XML Schema, validation, and namespaces
  • The concepts of character encoding and Unicode

For the code examples, you should be familiar with:

  • The programming language
  • Any interfaces or libraries used, such as CLI and JDBC
  • The data types that the language supports and how they map to DB2 SQL types

See the Resources section for links to this information.


System requirements

To complete this tutorial, you need the following:

  • A computer running Linux, UNIX, or Windows, with DB2 9 FixPack 1 installed
  • An editor, such as Rational Application Developer, Windows Notepad, or vi (see the Resources section of this tutorial for more information)
  • A compiler to run code examples. The DB2 Information Center page on supported programming languages and compilers for database application development links to pages listing supported compilers in all supported languages:
    • Supported C compilers: See the Resources section, subsection "Get products and technologies."
    • For the Java language, DB2 on Windows comes with a Java 2 SDK, Version 5, including the compiler javac and runtime environment (JRE), under SQLLIB\java\jdk. (On most platforms, DB2 9 supports Java 2 SDK, Versions 1.4.2 through 5. See DB2 Information Online, "Supported Java application development software," for details.) The JDK includes the JRE under the SQLLIB\java\jdk\jre directory. Your PATH environment needs to include the bin directories under jdk; CLASSPATH needs to include some JAR and ZIP files under SQLLIB\java.
  • A Web browser is handy for viewing an XML file, checking that it is well-formed, and finding mistakes

Running the examples

If you run the SQL examples from this tutorial in the DB2 Command Line Processor (CLP) db2, see the section titled "DB2 Command Line Processor (CLP) behavior and options."

1 of 14 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Information Management, XML
ArticleID=202451
TutorialTitle=DB2 9 Application Developer Certification Exam 733 prep, Part 3: XML data manipulation
publish-date=03162007
author1-email=payned@us.ibm.com
author1-email-cc=Robin_Langford@us.ibm.com

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.