Skip to main content Skip to complementary content
Close announcements banner

Migrating from DatabaseInsert to tDBOutput with multiple outputs

Update your Job and your multi-output map to replace the deprecated DatabaseInsert function with tDBOutput components.

You can follow the same steps to replace the DatabaseUpdate function.

Information noteImportant: The migration from DatabaseInsert or DatabaseUpdate with multiple outputs can be tricky. To avoid issues, make sure to perform the following steps in the order provided.

Before you begin

  • You have a Job containing a tHMap with multiple outputs that use DatabaseInsert functions.
  • 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 company information, and a tHMap that maps the XML data to two database tables. 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 output database tables from Metadata > Db Connections in your Job, after the tHMap.
  2. Select tDBOutput when prompted, then click OK.
  3. Link the tDBOutput components to your tHMap using Row > Main connections and enter a name for each connection.
    Information noteImportant: The name of each the output connections must be the same as the name of the root element of each table in the output structure of your map. In this example, the output elements are named employees and departments. To make the map work correctly, you need to name the connections employees and departments.
  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 all the database table structures 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 click Clear and click OK to remove the representation.
  7. Remove the DatabaseInsert functions in the output structure.

    They can be either on the element corresponding to the name of the database table or on the Row loop, in the IO/Database tab.

  8. Click the root element for each table in the output structure, employees and departments in this example, and add a WriteURL function in the IO/Database tab.
  9. Double-click the WriteURL function, click the [...] button next to the Representation field and select Map, then click OK.
  10. Save your map and your Job.

Results

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

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!