Programming Assignment #10
Storing XML in a Relational Database

Due on Tuesday May 1 before midnight.


This project must be done individually. No copying is permitted. The purpose of this project is to learn how to store XML data in a relational database.


You will do this project on your PC using Eclipse. You can find information about JDBC in the class slides (Web Programming with Servlets). If you have access to any relational database with a JDBC interface, then skip the next steps. Otherwise, you need to install Apache Derby. You can download the latest Derby bin distribution, the derby_core_plugin, and the derby_ui_doc_plugin from the Apache Derby download site. You should put the plugins inside the eclipse system directory (where you installed eclipse) and unzip them there (this will create two directories with jar files inside the plugin directory). Then restart eclipse to import these plugins. In eclipse, go to Window/Preferences/Data Management/Connectivity/Driver Definition. You should now be able to see the various drivers (if not, you probably unzipped the plugins in the wrong directory). Select Derby Client JDBC Driver 10.2 and push Add... and OK. Then, start the Derby server by executing the startNetworkServer script and keep it running. On eclipse, create an new Java Project, project10. Then go to Window/Open Perspective/Other.. and choose Database Development. Create a new Database Connection, select Derby and your Derby Client, and save password. You should test the connection to be sure that it connects with the Derby server. If you open your Derby connection, you will see that there is only one schema: sample. You may do your project using this schema. Switch back to the Java EE prospective from the Window/Open Perspective, right-click on project10 and select Apache Derby/Add Apache Derby Nature. You can create SQL tables by running ij (the SQL interpreter): right-click on project10 and select Apache Derby/ij. Your first ij command can be connect 'jdbc:derby://localhost:1527/sample'; to connect. You may use this in your project and change it to work with your tables (using JDBC).

Project Requirements

You will use the XML file cs.xml with the DTD department.dtd. You need to parse this file and store it into a relational database and then convert the relational data back to XML.

What to Submit

Use the form below to submit your java file and your relational schema:

Submit Project #10:

Last modified: 04/22/12 by Leonidas Fegaras