Migrating from DatabaseInsert to a single tDBOutput - 8.0

Talend Data Mapper User Guide

Version
8.0
Language
English
Product
Talend Big Data Platform
Talend Data Fabric
Talend Data Management Platform
Talend Data Services Platform
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Design and Development > Designing Jobs
Last publication date
2024-03-28
Update your Job and map to replace the deprecated DatabaseInsert function with a tDBOutput component. You can follow the same steps to replace the DatabaseUpdate function.

Before you begin

  • You have a Job containing a tHMap that uses a DatabaseInsert function.
  • You have created a connection to your database in Talend Studio. For more information, see Setting up a database connection. Make sure that the schema is identical to the structure used in your map.

About this task

In this example, you have a simple Job with a tFileInputRaw that reads an XML file containing employee information, and a tHMap that maps the XML data to a database table. The Job looks like this:
The map used in the tHMap looks like this:

The goal of this example is to remove the deprecated DatabaseInsert function and keep the same behavior for the Job.

Procedure

  1. Drag and drop your input database table from Metadata > Db Connections in your Job, after the tHMap.
  2. Select tDBOutput when prompted, then click OK.
  3. Link the tHMap to the tDBOutput using a Row > Main connection and enter a name for the connection.
  4. Click Yes when asked if you want to get the schema of the target component.
  5. In the Mapping perspective, expand the Representations folder under the database table structure used as output in your map.
    • If there is a Map representation, you can go to the next step.
    • If there is no Map representation, right-click Representations and click New Map.
  6. Open the map used in your Job and click Database on the Output side, then select Map and click OK to update the representation.
  7. Remove the DatabaseInsert function in the output structure.

    It can be either on the root element or on the Row loop, in the IO/Database tab.

  8. Save your map and your Job.

Results

Your Job is now using the tDBOutput component instead of the deprecated DatabaseInsert function. You can run the Job and you should get the same result.
Tip: You may need to close and reopen your Job to remove the error icon on the tHMap.