How to use the same tOracleConnection in the subjobs ?

One Star

How to use the same tOracleConnection in the subjobs ?

Hello Admins ,
Any Idea How to use the same Oracle Connection between different Jobs ?
the checkbox in tOracleOutput dosent work in this case,
Example:

tOracleConnection ----onSubJobOk------> tRunJob1 --------> tRunJob2
I want to use the same Oracle connection in jobs (1 and 2) how to manage it ?

Thanks in advance
Joseph
Moderator

Re: How to use the same tOracleConnection in the subjobs ?

Hi, Chaficc
We have designed a job for your requirement. Call the 1st job as parent job and the 2nd as child job.
Parent job: see pic1
1. On tMysqlConnection_1: create a Mysql DB connection; select the Use or register a shared DB connection box to register a shared DB connection and type in a connection name in the Shared DB connection Name field, for example "Conn".(pic2)
2. On tFixedFlowInput_1: generate a set of test data.(pic3)
3. On tMysqlOutput_1: insert the data into a table called "person"; select the Use an existing connection box to use an existing connection created on tMysqlConnection_1; select Drop table if exists and create item from the Action on table list, this means the Job will create the table if it doesn't exist, drop the table if it already exists and create it again. (pic4)
4. On tRunJob_1: call the 'ChildJob' Job.(pic5)
5. On tMysqlCommit: commit the changes if the Job works fine and close the DB connection.
6. On tMysqlRollback: Rollback the changes if the Job fails and close the DB connection.
Child job(pic6)
1. On tMysqlConnection_1: select the Use or register a shared DB connection box to use a shared DB connection and type in the connection name "Conn", which is defined in ParentJob Job, in the Shared DB connection Name field. We don't need to set the DB connection parameters like Host on this component, allow them to be empty, as the component will use a shared DB connection.?pic7?
2. On tMysqlInput_1: read data from "person" table.
3. On tLogRow_1: print the data on the console.

Best Regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: How to use the same tOracleConnection in the subjobs ?

I have the same issue with Oracle. Your note says " leave parameters blank". I tried using "" and " ". But, I get message:
Exception in component tOracleConnection_1
java.sql.SQLException: Invalid number format for port number
If I leave box blank, the job won't generate. It says required fields are missing.
Moderator

Re: How to use the same tOracleConnection in the subjobs ?

Hi,
Did you create a t<DB>connection in Parent job with information? Please paste your job design screenshots into forum so that we can address your issue quickly.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: How to use the same tOracleConnection in the subjobs ?

I am using Talend for MDM version 5.2.2. MY job calls 9 subjobs. I cut the image from the calling job SC_Data_load_1 and one of the called jobs Stage_R3_KNA1_ALL.
I didn't see the images. I am editing to try again.
One Star

Re: How to use the same tOracleConnection in the subjobs ?

Hi Sabrina,

I have a small question on the subjob. So if we call "Use or register a shared DB connection" for multiple subjobs. Will it open a single DB connection for multiple jobs or will it open multiple connections for multiple subjobs in DB
Thanks,
Ganesh
One Star

Re: How to use the same tOracleConnection in the subjobs ?

Hi Sabrina,
Can you please send me the pics of the jobs (parent & child) ?
Thank you
Abdellah
Moderator

Re: How to use the same tOracleConnection in the subjobs ?

Hi Abdellah,
Please take a look at this KB article about:TalendHelpCenterSmiley Frustratedharing database connection between parent job and child job
Let us know if it is Ok with you.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.