Skip to main content Skip to complementary content

Migrating from DatabaseSelect to tDBInput with multiple inputs

Update your Job and multi-input map to replace the deprecated DatabaseSelect function with tDBInput components.

Before you begin

  • You have a Job containing a tHMap with multiple inputs that use DatabaseSelect 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 tHMap that selects data from two database tables containing company information, and maps it to an XML structure. Then, a tFileOutputRaw writes the result to an XML file. The Job looks like this:
The map used in the tHMap looks like this:

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

Procedure

  1. Drag and drop your input database tables from Metadata > Db Connections in your Job, before the tHMap.
  2. Select tDBInput when prompted, then click OK.
  3. Link the tDBInput components to your tHMap using Row > Main connections.
    Information noteImportant: The database tables must be linked in the same order as in the input structure used in the map. In this example, the first table under root is employees and the second one is departments. To make the map work correctly, you need to link the employees component first, then the departments component.
  4. Optional: If needed, double-click the tDBInput components and update the query to match the filters used in the DatabaseSelect function.
  5. In the Mapping perspective, expand the Representations folder under all the database table structures used as input 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 Input side, then click Clear and click OK to remove the representation.
  7. Remove the DatabaseSelect functions in the input 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 input structure, employees and departments in this example, and add a ReadURL function in the IO/Database tab.
  9. Double-click the ReadURL 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 tDBInput components instead of the deprecated DatabaseSelect 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!