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]

Use an XML database in PHP and Java applications

Understand the benefits of using a native XML database

Tyler Anderson (tyleranderson5@yahoo.com), Freelance writer and developer, Backstop Media
Tyler Anderson has graduated with a degree in computer science in 2004 and a Master of Science degree in computer engineering in December, 2005, both from Brigham Young University. Tyler is currently a freelance writer and developer for Backstop Media.

Summary:  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.

Date:  25 Mar 2008
Level:  Intermediate PDF:  A4 and Letter (1511 KB)Get Adobe® Reader®

Activity:  33259 views
Comments:  

Before you start

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.

About this tutorial

Frequently used acronyms

  • DOM: Document Object Model
  • HTML: Hypertext Markup Language
  • HTTP: Hypertext Transfer Protocol
  • JDK: Java Development Kit
  • PHP: PHP: Hypertext Preprocessor
  • SDK: Software development kit
  • XML: Extensible Markup Language

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, including how to:

  • 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
    • Make database changes unnecessary!

To learn and implement the above concepts, 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.


Prerequisites

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.

1 of 10 | 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=XML, Information Management, Java technology, Open source
ArticleID=296102
TutorialTitle=Use an XML database in PHP and Java applications
publish-date=03252008
author1-email=tyleranderson5@yahoo.com
author1-email-cc=dwxed@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.