Programming Assignment #9
Storing XML in a Relational Database

Due on Thursday April 25 before midnight.


Description

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.

Platform

You will do this project on your PC using Eclipse. You can find information about JDBC in the class slides (Web Programming with Servlets).

Please read Eclipse DTP Tutorial - Database Tools

On Eclipse, go to "Install New Software..." and install Database Development/Data Tools Platform Enablement Extender SDK. To install Apache Derby, you need to download the latest Derby bin distribution from the Apache Derby download site. On eclipse, go to Window/Preferences/Data Management/Connectivity/Driver Definition. You should now be able to see the various drivers. Select Derby Embedded JDBC Driver 10.2 Default and push Edit... Got to JarList and insert or replace the jar file with the derby.jar file in the lib subdirectory in your Derby bin distribution. Then go to Window/Open Perspective/Other.. and choose Database Development. Select "Database Connections" and right mouse click, select new, and then Derby. Select Drivers to be "Derby Embedded JDBC Driver 10.2" and create and save a username/password. You should test the connection to be sure that it connects with the Derby server.

On eclipse, create an new Java Project, project9. If you open your Derby connection, you will see that there is only one schema: MyDB. You may do your project using this schema. Switch back to the Java EE prospective from the Window/Open Perspective, right-click on project9 and select Apache Derby/Add Apache Derby Nature. You can create SQL tables by running ij (the SQL interpreter): right-click on project9 and select Apache Derby/ij. Your first ij command can be connect 'jdbc:derby:/home/fegaras/MyDB'; to connect (look this string in the Derby database properties). You may use this Main.java 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 #9:

Last modified: 04/16/13 by Leonidas Fegaras