Import XML instances into RDBMS

Preparation

If you already started the first task just continue working on your project using IntelliJ. Otherwise read the first task regarding the skeleton project import.

Description

Write a Java application reading <company> document instances and writing <department> elements among with their hierarchical structure and <member> entries to a relational database. Do not consider <project> related data at all. Hints:

  • de.hdm_stuttgart.mi.sda1.Company2Rdbms contains JDBC related connection parameters and boilerplate code.

  • Upon invocation class de.hdm_stuttgart.mi.sda1.Driver instantiates de.hdm_stuttgart.mi.sda1.Company2Rdbms thereby:

    • Reading and parsing Schema/sampledata.xml.

    • Open a database connection to your local PostgreSQL server.

Tasks

Pre- create your database schema from your last task's Schema/schema.sql using the IDE prior to running your application. Implement the subsequently mentioned features. Each section adds points to your marking. Using PreparedStatement instances should be preferred. Idea:

  1. Get all top level <department> entries first.

  2. From each top level <department> recurse to <department> children actually using JDBC to insert your data.

  3. Allow for multiple invocations: Import conflicts (i.e. duplicate lectures or marks) should create informal warnings but your application should try to continue anyway.

Hints
  • Executing de.hdm_stuttgart.mi.sda1.Driver calls de.hdm_stuttgart.mi.sda1.Company2Rdbms.execute() already containing both your XML instance's root element and a database connection handle.

  • Even if your application just fills in e.g. (only top level) <department> values excluding <member> data you'll receive points. Also partly meaningful but not fully working code may contribute.

Solution upload

Upload your project using the first task. Enter either of the following two texts below:

  • I'm expecting points for my work on the current task.

  • I did not work on this task.

You may as well add other marking related comments.