Chapter 1. Overview

Table of Contents

Basic Concepts
Running the Shell
Getting Help

Welcome to Berkeley DB XML (BDB XML), an embeddable XML database engine that provides support for XQuery access. This document will introduce you to BDB XML's feature set. After reading this document you should have a good understanding of what BDB XML can do for you and how it might be used to manage XML data within your systems and applications. Follow along with the examples and try out BDB XML on your system.

BDB XML is an embedded database specifically designed for the storage and retrieval of XML-formatted documents. Built on the award-winning Berkeley DB, BDB XML provides for efficient queries against millions of XML documents using XQuery. XQuery is a query language designed for the examination and retrieval of portions of XML documents.

Basic Concepts

Typically, BDB XML is used as a library that is linked directly into your application. In addition, BDB XML has a command line shell that allows you to work with XML documents outside of the programming languages that you normally use to interact with BDB XML. You can use the command line shell as part of your application, as a management tool, or simply as a means to explore the features of the product as we do here.


Remember that BDB XML is an embedded database engine that supports XML data and queries against that data. This means that in contrast to other database systems, Berkeley DB (and BDB XML) is not a relational database, is not a database server, and it does not support SQL queries. Instead, it is a libarary that is meant to be used directly with your code and which provides XQuery queries against the XML data that you store within the engine.

In BDB XML, all XML data is stored within files called containers. The BDB XML shell provides a simple and convenient way to work with these containers and exposes most of the BDB XML functionality in a friendly, interactive environment, without requiring the use of a programming language.

Containers are really a collection of XML documents and information about those documents. For example, containers include any indexes that are being maintained for the documents.

Containers also store XML documents as either whole documents or as nodes. When containers store whole documents, the XML document is stored all as one unit in the container exactly as it was presented to the system. When documents are stored as nodes, the XML document is deconstructed into smaller pieces – nodes – and those small chunks are what is stored in the container.

For the node storage case, retrieval of the document still returns the document in mostly the same formatting state (assuming you didn't modify it) as it was in when it was stored in the container. The only difference is how the document is physically held within the container. Note that node storage typically offers better performance than does whole document storage, and for this reason node storage is the default container type.


In some cases, node storage may change your document slightly. For example, an empty node in your document like this:


Will be stored in the container and returned as this: