Ready to get started?

Learn more about the CData JDBC Driver for XML or download a free trial:

Download Now

Connect to XML Data in CloverETL

Transfer XML data using the visual workflow in the CloverETL data integration tool.

The CData JDBC Driver for XML enables you to use the data transformation components in CloverETL to execute create, read, update, and delete (CRUD) commands to XML data. In this article, you will use the JDBC Driver for XML to set up a simple transfer into a flat file.

Connect to XML as a JDBC Data Source

  1. Create the connection to XML data. In a new CloverETL graph, right-click the Connections node in the Outline pane and click Connections -> Create Connection. The Database Connection wizard is displayed.
  2. Click the plus icon to load a driver from a JAR. Browse to the lib subfolder of the installation directory and select the cdata.jdbc.xml.jar file.
  3. Enter the JDBC URL. A typical JDBC URL is below: jdbc:xml:URI=C:\people.xml;DataModel=Relational;

    See the Getting Started chapter in the data provider documentation to authenticate to your data source: The data provider models XML APIs as bidirectional database tables and XML files as read-only views (local files, files stored on popular cloud services, and FTP servers). The major authentication schemes are supported, including HTTP Basic, Digest, NTLM, OAuth, and FTP. See the Getting Started chapter in the data provider documentation for authentication guides.

    After setting the URI and providing any authentication values, set DataModel to more closely match the data representation to the structure of your data.

    The DataModel property is the controlling property over how your data is represented into tables and toggles the following basic configurations.

    • Document (default): Model a top-level, document view of your XML data. The data provider returns nested elements as aggregates of data.
    • FlattenedDocuments: Implicitly join nested documents and their parents into a single table.
    • Relational: Return individual, related tables from hierarchical data. The tables contain a primary key and a foreign key that links to the parent document.

    See the Modeling XML Data chapter for more information on configuring the relational representation. You will also find the sample data used in the following examples. The data includes entries for people, the cars they own, and various maintenance services performed on those cars.

Query XML Data with the DBInputTable Component

  1. Drag a DBInputTable from the Readers selection of the Palette onto the job flow and double-click it to open the configuration editor.
  2. In the DB connection property, select the XML JDBC data source from the drop-down menu.
  3. Enter the SQL query. For example: SELECT * FROM people

Write the Output of the Query to a UniversalDataWriter

  1. Drag a UniversalDataWriter from the Writers selection onto the jobflow.
  2. Double-click the UniversalDataWriter to open the configuration editor and add a file URL.
  3. Right-click the DBInputTable and then click Extract Metadata.
  4. Connect the output port of the DBInputTable to the UniversalDataWriter.
  5. In the resulting Select Metadata menu for the UniversalDataWriter, choose the people table. (You can also open this menu by right-clicking the input port for the UniversalDataWriter.)
  6. Click Run to write to the file.
 
 
ダウンロード