An extremely simple scenario has been created to assist you in loading data provided in XML to a database using JDBC. The java code, XmlLoadExample.java, an xml data file enrollment.xml (also contains the DTD schema) and a DDL file enrollment.sql are provided. The schema contains 3 tables, class, student and enrollment. It is your typical many to many relationship, also note the constraints definitions.

The java application is using a command line similar to the JDBCExample, you will need to provide the userid, userpassword, databaseURL and the file containing your XML data. You will have to include parser.jar and jaxp.jar on your classpath. These are probably not the latest versions of the jar files, however there should not be any compatibility issues with newer versions of the JAXP API.

We have modified the application slightly in order to introduce Oracle sequences, the DDL and XML input file have been modified accordingly. If you have already run the old application you will have to drop the three tables. Drop the enrollment table first.

cs610.XmlLoadExample -dbUser dbUserId - dbPassword dbPasswd -dbURL dbURL -xmlFile xmlFile

The query example uses a very simple query, listing all the students who have taken classes and their grade (therefore it is using the newer schema). The emphasis is not on the query but on the generic way of converting a ResultSet to a XML datagram.

cs610.QueryXmlExample -dbUser dbUserId -dbPassword dbPassword -dbURL dbURL

In order to run this application successfully, you will have to create the tables first.