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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Pass connection object to Talend job from Java program

We gave a try to pass connection object form Java program to talend job and found a way to do the same.
Any talend job will have two hash map namely globalMap(private) and parentContextMap(public).
To pass the object we wrote a wrapper class which will inturn extend the original talend job.
Java wrapper class:
public class wrapper extends FetchCustomer_Mainjob{
public static void invokeJob(){
parentContextMap.put("conn_tOracleConnection_1",Util.getConnection());
String[] contextParam = {.....}
String[][]=runJob(contextParam);
}
}

FetchCustomer_Mainjob:
tJavaRow -->tOracleInput--->tMap--->tOracleOutput
Code in tJavaRow:
globalMap.put("conn_tOracleConnection_1",parentContextMap.get("conn_tOracleConnection_1") 0683p000009MA9p.png
com.common.ThreadLocalMap.put("conn_tOracleConnection_1",parentContextMap.get("conn_tOracleConnection_1"));

FetchCustomer_SubJob1:
tJavaRow -->tOracleInput --->tFileOutputExcel
Code in tJavaRow:
com.common.ThreadLocalMap.put("conn_tOracleConnection_1",parentContextMap.get("conn_tOracleConnection_1"));
globalMap.put("conn_tOracleConnection_1",com.common.ThreadLocalMap.get("conn_tOracleConnection_1"));
Clear the ThreadLocalMap values in main job success/error.
Committ the transaction in talend job or in java code based on your businesss conditions.
Labels (3)
10 Replies
_AnonymousUser
Specialist III
Specialist III

Hi while running my job it got stuck in between , so i tried running in debug mode , Talend got stuck while creating java object ... Can u pls tell me where m going wrong .