Export

The export process fetches metadata and data from a relational database and persists it as XML files.

It does the following:

  1. Extracts database metadata information (table- and columns names, types, etc.) using Java code (JDBC) and serializes it as XML.

  2. Uses this metadata XML as an input and creates an Ant export configuration for DBUnit. Code: XSLT.

  3. Runs DBUnit to export the data and serializes it as XML (relational model), since - as mentioned earlier - DBUnit has Apache Ant integration. Code: XML.

DBUnit is an open source tool to export and import database data to and from XML datasets. It's database vendor agnostic, has a connector for most widely used databases. It has a streaming mode to deal with big data. In our configuration, we exported each table into a single XML file. The largest XML output file so far was 43 GB.

Example 4. XML data using the relational model - from DBUnit:

<table name="employee">
    <column>employee-id</column>
    <column>first-name</column>
    <column>second-name</column>
    <row>
        <value>e1</value>
        <value>Ola</value>
        <value>Nordmann</value>
    </row>
    <row>...</row>
</table>