Scenario: Writing data from a database table into an LDIF file - 6.1

Talend Components Reference Guide

EnrichVersion
6.1
EnrichProdName
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for Big Data
Talend Open Studio for Data Integration
Talend Open Studio for Data Quality
Talend Open Studio for ESB
Talend Open Studio for MDM
Talend Real-Time Big Data Platform
task
Data Governance
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

This scenario describes a Job that loads data into a database table, and then extracts the data from the table and writing the data into a new LDIF file.

Adding and linking components

  1. Create a new Job and add the following components by typing their names in the design workspace or dropping them from the Palette: a tFixedFlowInput component, a tMysqlOutput component, a tMysqlInput component, and a tFileOutputLDIF component.

  2. Link tFixedFlowInput to tMysqlOutput using a Row > Main connection.

  3. Link tMysqlInput to tFileOutputLDIF using a Row > Main connection.

  4. Link tFixedFlowInput to tMysqlInput using a Trigger > On Subjob Ok connection.

Configuring the components

Loading data into a database table

  1. Double-click tFixedFlowInput to open its Basic settings view.

  2. Click the [...] button next to Edit schema and in the pop-up window define the schema by adding four columns: dn, id_owners, registration, and make, all of String type.

  3. Click OK to close the schema editor and accept the propagation prompted by the pop-up dialog box.

  4. In the Mode area, select Use Inline Content(delimited file), and then in the Content field displayed, enter the following input data:

    24;24;5382 KC 94;Volkswagen
    32;32;9591 0E 79;Honda
    35;35;3129 VH 61;Volkswagen
  5. Double-click tMysqlOutput to open its Basic settings view.

  6. Fill in the Host, Port, Database, Username, and Password fields with your MySQL database connection details.

  7. In the Table field, enter the name of the table into which the data will be written. In this example, it is ldifdata.

  8. Select Drop table if exists and create from the Action on table drop-down list.

Extracting data from the database table and writing it into an LDIF file

  1. Double-click tMysqlInput to open its Basic settings view.

  2. Fill in the Host, Port, Database, Username, and Password fields with your MySQL database connection details.

  3. Click the [...] button next to Edit schema and in the pop-up window define the schema by adding four columns: dn, id_owners, registration, and make, all of String type.

  4. In the Table Name field, enter the name of the table from which the data will be read. In this example, it is ldifdata.

  5. Click the Guess Query button to fill in the Query field with the auto-generated query.

  6. Double-click tFileOutputLDIF to open its Basic settings view.

  7. In the File Name field, browse to or enter the path to the LDIF file to be generated. In this example, it is E:/out.ldif.

  8. Select the operation Add from the Change type list.

  9. Click the Sync columns button to retrieve the schema from the preceding component.

Saving and executing the Job

  1. Press Ctrl+S to save your Job.

  2. Press F6 or click Run on the Run tab to execute the Job.

    The LDIF file created contains the data from the database table and the change type for the entries is set to add.