Connect Talent Studio To MySQL Server

[1] Prep Connection

  1. Open Talend Studio.

  2. Create a New Database Connection:

    • Go to the Repository panel.

    • Right-click on Metadata > Db Connections > Create connection.

  3. Configure Connection Settings:

    • Database: MySQL.

    • Host: localhost (or 127.0.0.1)

    • Port: 3306

    • Database: talend_db

    • Username: root

    • Password: your_password

Test the Connection: Click on Check to ensure that Talend can connect to your MySQL instance. If successful, click Next and then Finish.

[2] Prep Job

Step 1: Create a New Job

  1. Open Talend Studio.

  2. In the Repository panel, right-click on Job Designs and select Create Job.

  3. Give your job a name (e.g., MySQLExampleJob) and click Finish.

Step 2: Drag and Drop Components

  1. In the Palette panel, search for tMysqlInput and drag it onto the design workspace.

  2. Add a tLogRow component to display the output data. Drag it onto the workspace as well.

Step 3: Configure tMySQLInput

  1. Click on the tMySQLInput component to select it.

  2. In the Component tab, configure the following settings:

    • Property Type: Select Repository.

    • Repository: Select the MySQL connection you created earlier.

    • Table: Choose a table from the talend_db database (e.g., your_table_name).

    • Query: You can either use the GUI to select the columns or write a custom SQL query.

Step 4: Configure tLogRow

  1. Click on the tLogRow component.

  2. In the Component tab, set Mode to Table for easy visualization of the output.

Step 5: Connect Components

  1. Click on the small arrow on the right side of the tMySQLInput component and drag it to the tLogRow component to create a link.

  2. In the dialog that appears, select Row > Main to indicate the flow of data.

Test the job.

Additional (output to table)

Step 6: Configure tMySQLOutput

  1. Click on the tMySQLOutput component.

  2. In the Component tab, configure the settings:

    • Property Type: Select Repository.

    • Repository: Choose the same MySQL connection.

    • Table: Specify the output table (you can create a new one or use an existing one).

    • Action on Table: Choose whether to Insert, Update, or Delete records based on your needs.

    • Mapping: Map the input columns to the output table columns.

  3. Connect the tLogRow component to the tMySQLOutput component using a similar drag-and-drop method.

Step 7: Run the Job

  1. Click on the Run tab at the bottom of the workspace.

Click the Run button to execute the job.