Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to make multiple connections with Talend Job?

I am writing a talend job to replicate mysql database from client to server I am using "tmysqlconnection" and tmysql_row" component now the difficulty here is I am passing context params to my job like

USE "+context.destination_database+";

SET SQL_SAFE_UPDATES = 0;
SET FOREIGN_KEY_CHECKS = 0;



SELECT GROUP_CONCAT(concat('main.', column_name)) 
    INTO @fields_name
    FROM  information_schema.columns 
    WHERE table_schema=DATABASE() AND table_name='"+context.mysql_source_table+"';

SELECT @fields_name;


SELECT id FROM "+context.mysql_source_database+"."+context.mysql_source_table_mac+" order by id asc limit 2,1  INTO @mac_id;

SELECT @mac_id;

its a small portion of myquery in which destination database in my servers database located on some other machine and source database is clients machine the real problem came here because my talend job use the specific database ie client or server to find both databases which results in to job failure how can i connect to both of my mysql databases and use the context params in my query so that my job knows that from which database i can expect data

Labels (3)
2 Replies
Anonymous
Not applicable
Author

Hi,

 

    Could you please rephrase your query? I couldn't understand what you are trying to say.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

lennelei
Creator III
Creator III

Hi,

 

first create two distinct connections with the correct settings : one for your client and the other for your server.

 

Then, use a tmysqlinput to read data from the client and a tmysqloutput to write data to the server, each component using it's respective connection.

 

You don't have to use "select into...", just use "select ..." in a different tmysqlinput component with the correct schema defined.

 

You should end up with something like this :

tMySQLConnection_1 --OnComponentOk--> tMySQLConnection_2
    |
OnSubjobOk
    |
v tMySQLInput_1 ==main==> tMySQLOutput_1 | OnSubjobOk |
v tMySQLInput_2 ==main==> tMySQLOutput_2 ...