Welcome!

XML Authors: Jnan Dash, Sandi Mappic, Max Katz, Yakov Fain, Keith Mayer

Related Topics: XML, Open Source

XML: Article

eXist - An Introduction To Open Source Native XML Database

I am going to introduce you to the open source, free (GNU LGPL license), native XML database eXist (www.exist-db-org)

In this article I am going to introduce you to the open source, free (GNU LGPL license), native XML database eXist (www.exist-db-org). Data is important, no question about it. Data that can't be queried is not very useful. Users expect to have good query response time. From my personal experience and testing, I am confident in saying that eXist is a fairly good database. It has very good query response time, it is very user friendly, it's easy to set up and operate, and it's written in Java, therefore it is platform independent.

This article will show you how to use eXist as a stand-alone database server. If you have any problems or questions you can use the mailing list of eXist. The odds are somebody else had the same problem you have and it's already been answered in the mailing list.

Although eXist is written in Java, you don't have to be a Java programmer in order to use eXist. You can use the graphical user interface (GUI) for almost anything you need to accomplish. Anything that can be done through the GUI can also be done by using command line. This should please the programmers among us who are deeply attached to the command-line tools rather than fancy to GUIs. Let's start exploring eXist.

System Requirements
You need a JRE (Java Runtime Environment) 1.4 or later. This is the only requirement. The documentation states that the package is tested on Linux and Windows XP/2000. Keep in mind that it should work on other operating systems with no problem, because it's platform independent. I set it up on Dell PowerEdge 2600 running on Windows 2003 Server.

Features of eXist
eXist is a native XML database because it is designed and built for XML. Other databases, such as relational databases (Oracle, DB2, MS SQL Server 2000), can handle XML data too, but they are not native XML databases, because they aren't built for XML.

I will list only the most important features of eXist, but if you are interested, you can find a complete list of features at www.exist-db.org:

  • eXist supports many popular XML query languages such as XQuery, XPath, and XSLT
  • It has an automatic indexing features that lets it creates indexes while storing data
  • It supports data update
  • It supports SOAP and XML-RPC protocols
  • It doesn't support database transactions at this time, but it supports concurrent access
Step-by-Step Installation
1.  Get JVM (Java Virtual Machine)
If you don't have a JVM on your system already (1.4 or later), you should download one for free from Sun Microsystems (http://java.sun.com/j2se/). Make sure that your version is at least 1.4. As I write, the latest version of Java is 1.5.0_05 (also known as J2SE 5.0), which is I used for this article (see Figure 1).

2.  Set JAVA_HOME variable
The value of this variable is the full path to your Java installation directory. This is how I set up the JAVA_HOME environment variable on my system:

Control Panel->System->Advanced->Environment Variables->System Variables.

Next I created a new environment variable called "JAVA_HOME," with the value "C:\Program Files\Java\jdk1.5.0_05" (it may be different on your system).

To check if you set up the variable correctly, open a new command prompt window. Type "echo %JAVA_HOME%." You should see the Java installation directory printed on the screen (see Figure 2).

3.  Download eXist
You can download it from www.exist-db.org. For this article I used the most recent development snapshot: "eXist-snapshot-20050805.jar." (Note that the stable version eXist-1.0b2-build-1107.jar is referred to as "ancient." Interestingly enough, it still appears at the top of the list. Get the latest development version instead of the stable version.) (see Figure 3)

In order to run the installation program type:

java -jar eXist-snapshot-20050805.jar

That's it, we have installed it. Now you should see "eXist XML Database" entry in the Start->All Programs menu. Now you are ready to run eXist database server as a stand-alone application (see Figure 4).

Start eXist database server by selecting "eXist Database Startup" at the "eXist XML Database" program menu.

Let's start the client, the GUI that allows us to perform useful database operations such as querying the data and adding a file to or deleting a file from the database.

Start the client by selecting "eXist Client Shell" from the "eXist XML Database" program menu. For now the user "admin" who is the administrator doesn't have a password by default (I recommend creating a password for the admin as soon as possible). (see Figure 5)

Storing XML
Let's use the eXist client program to store XML data. Some of the things that the client program allows a user to do are:

  • create collections
  • store data
  • query data
  • create backup
  • restore files from backup
  • manage users
You should put related XML data under a collection. Just as for the file system, collections help organizing your data better. For example, if you have 100 XML orders, you should probably create an "Orders" collection and store all of the orders under this collection.

If you don't have suitable XML data at hand you use XBench, which is an XML benchmark (see the References section for more information). It comes with a random data generator and predefined set of queries. For this article I used a 10MB XML data file generated by XBench. You can download this data at www.cs.umb.edu/~smimarog/eXist/dictionary10.xml.

Follow these steps:

  • Download "dictionary10.xml" to your system.
  • Create a new collection using eXist client "File->Create Collection." Name it as XBench (see Figure 6). Now, you should see two collections: System and XBench (see Figure 7). The System collection is created by eXist at the installation, and it has system information.
  • Select XBench collection.
  • This collection is empty at the moment.
  • Select "File->Store files/directories." Browse and select "dictionary10.xml."
  • This will store the data. On my system it took less than a minute to store the data. This storage time varies, depending on your system.
Now that we have stored the data we are ready to query it. Note that while storing the data, eXist quietly created default indexes. Default indexes are generally enough for most purposes, but if you are willing to use eXist extensions, you can also create indexes manually, which will improve performance. Check the eXist documentation for details on this topic.

More Stories By Selim Mimaroglu

Selim Mimaroglu is a PhD candidate in computer science at the University of Massachusetts in Boston. He holds an MS in computer science from that school and has a BS in electrical engineering.

Comments (1) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
XML News Desk 11/29/05 07:22:28 PM EST

eXist - An Introduction To Open Source Native XML Database. In this article I am going to introduce you to the open source, free (GNU LGPL license), native XML database eXist (www.exist-db-org). Data is important, no question about it. Data that can't be queried is not very useful. Users expect to have good query response time. From my personal experience and testing, I am confident in saying that eXist is a fairly good database. It has very good query response time, it is very user friendly, it's easy to set up and operate, and it's written in Java, therefore it is platform independent.