Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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?

  0683p000009MCOv.png
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.
Labels (3)
1 Reply
Anonymous
Not applicable
Author

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