I want to retry db connection, but it doesn't work

Five Stars

I want to retry db connection, but it doesn't work

hi. I want to retry(attempt) db connection.. 

how do i retry db connection?

 
tJava_1 : context.continueLooping = true;
tLoop_1 : 

tOracleConnection : I entered a wrong pw intentionally.  ( i'll check connect to success) 
tJava_2 : context.continueLooping = false;
System.out.println("Connection on attempt # "+ ((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION")).toString());
tJava_3 : 
if (((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION")) < 5 )
{
System.out.println("Connection Failed. Retrying .... "+((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION")));
context.continueLooping = true;
}
else
{
System.out.println("Connection Failed.");
context.continueLooping = false;
}
tSleep_1 : 3sec

how do i retry db connection?
thank you for read it.
Community Manager

Re: I want to retry db connection, but it doesn't work

Hi  
You should redesign the jobs with main/child job structure:
main:
tLoop--iterate--tRunJob--main--tJavaRow
on tJavaRow: check the iteration number, receive the status from child job and define the value of context.continueLooping
tRunjob: call the child job and pass the connection status to main job, uncheck the 'die on error' option.
child job:
tOracleconnection
   -onsubjobok--tFixeFlowinput--main--tBufferoutput (pass status to main job)
   -onsubjoberrorr--tsleep--oncomponentok--tfixedFlowInput--main--tBufferoutput (pass status to main job)
Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business