Connect Talent Studio To MySQL Server
[1] Prep Connection
Open Talend Studio.
Create a New Database Connection:
Go to the Repository panel.
Right-click on Metadata > Db Connections > Create connection.
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
Open Talend Studio.
In the Repository panel, right-click on Job Designs and select Create Job.
Give your job a name (e.g., MySQLExampleJob) and click Finish.
Step 2: Drag and Drop Components
In the Palette panel, search for tMysqlInput and drag it onto the design workspace.
Add a tLogRow component to display the output data. Drag it onto the workspace as well.
Step 3: Configure tMySQLInput
Click on the tMySQLInput component to select it.
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
Click on the tLogRow component.
In the Component tab, set Mode to Table for easy visualization of the output.
Step 5: Connect Components
Click on the small arrow on the right side of the tMySQLInput component and drag it to the tLogRow component to create a link.
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
Click on the tMySQLOutput component.
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.
Connect the tLogRow component to the tMySQLOutput component using a similar drag-and-drop method.
Step 7: Run the Job
- Click on the Run tab at the bottom of the workspace.
Click the Run button to execute the job.