The repository we will build consists of a relational database, containing tables and the stored procedures needed to access them, and Java classes that provide an interface layer upon which applications can be built. The stored procedures form a rudimentary API for the Java classes; the classes do not need to know about the underlying table design?all they require knowledge of are the stored procedures that insert, select, update, and delete information for them. This (logical) three-tier architecture?consisting of database objects (the tables), a data-access level (the stored procedures), and repository-aware Java classes?provides a basic platform upon which we can build applications that persist and manipulate XML documents in a relational database. The files in the code download for this chapter are summarized in Table 8.1.
There are also some example XML files for you, the reader, to test the system with. The code samples have been tested on various Windows PCs running Java 2, Microsoft SQL Server, and the Apache Xerces class library, but they should work on other platforms; the majority of the SQL is generic, and I have tried to keep the stored procedures as simple as possible.
Go to http://xml.apache.org/dist/xerxes-j/ and download the most recent binaries. For my Windows PC, I downloaded Xerces-J-bin.2.0.1.zip and unzipped the contents to C:\Program Files\Javasoft\xerxes-2_0_1. Add the jar files to your classpath environment variable. Xerces comes with some excellent examples that can be tested from the command line to ensure that the Java environment and XML libraries are working properly before we start.