Skip to main content


developerWorks  >  XML | Information Management | Java technology | Open source  >

Use an XML database in PHP and Java applications

Understand the benefits of using a native XML database

developerWorks

Level: Intermediate

Tyler Anderson (tyleranderson5@yahoo.com), Freelance writer and developer, Backstop Media

25 Mar 2008

Register now or sign in using your IBM ID and password.

Native XML databases have grown in popularity along with XML, because data is stored as native XML, rather than through tables in a traditional database. Using a native XML database means that a change to the schema requires minimal changes to your code and no change to the database. PHP and Java™ developers can benefit greatly from using native XML databases. In this tutorial, you will get quickly up to speed using a native XML database and see how to use it to benefit XML development.

In this tutorial

This tutorial shows you how to reduce development time with a native XML database. As an illustration, you will change an existing XML schema, and see these changes in the code also. Developers will learn the common necessities for working with a native XML database in both PHP and Java technologies.

To learn and implement the tutorial objectives, you'll create several Web applications where users can enter and view patient data in PHP code, and then enter and view doctor data in Java code.


Objectives

  • Connect to the database (DB2 Express-C 9.5).

  • Store and retrieve XML data.

  • Create a form that writes new data to the database.

  • Create a form that reads existing data from the database.

  • Query the database using SQL/XML.

  • Enhance the data viewers to support a quick search function.

  • Modify the database schema.

Prerequisites

This tutorial is recommended for Java and PHP developers who use XML and want to explore the benefits of native XML databases (IBM® DB2® Express-C 9.5 in this tutorial). Although it is helpful to have some knowledge of PHP and Java programming, it isn't necessary to follow along and learn from this tutorial. Knowledge of the XML DOM is also helpful.


System requirements

You will need JavaScript enabled in your browser.

Beyond a text editor and a browser, you'll need the tools necessary to support Java and PHP servers:

  • Java JDK, the latest JDK from Sun to run and compile Java code. This tutorial uses version Java 6 update 5.
  • Apache Tomcat, the Web server that will host your Java applications. This tutorial uses version 6.0.16.
  • PHP, the latest version of PHP, 5.2.5 at the time of this writing.
  • Apache2, the Apache2 HTTP server that is the recommended HTTP server for PHP.
  • Operating System, any will do. This tutorial was written on a machine running Windows Vista® Ultimate.
  • DB2 Express-C 9.5, the database used for this tutorial. You can use any native XML database such as Apache Xindice instead.

You can get all the source code from Downloads in the tutorial.



Duration

1 hour





Formats

html, pdf


Share this....

digg Digg this story del.icio.us del.icio.us Slashdot Slashdot it!


Back to top


Document options

Document options requiring JavaScript are not displayed