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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

DB Connection Re-try

Hi,

I have a requirement where I have to re-try DB Connection for 5 times untill it connects. A flow like this:
start->Db Connect-> if connection succeeds->go to next component
                         ->if connection fails->sleep for 5 seconds->re-try for 5 more times->if connection succeeds-> go to next component
                                                                                                                  ->if connection fails -> die

Please help.

Labels (2)
2 Replies
Anonymous
Not applicable
Author

Hi,
Could you please take a look at this scenario: TalendHelpCenter0683p000009M9p6.pngcenario: Job execution in a loop to see if it is satisfying your needs?
Best regards
Sabrina
Anonymous
Not applicable
Author

You need to establish a loop, try your connection. determine if it was successful. break loop on success. sleep and retry on failure. break loop when you've tried x (5) times.
Test for success and failure after loop.

You may be able to use OnSubjobOk and OnSubjobError to determine success or failure.

If these connectors do not cut it, you can also set-up your own Exception Handler, using tJavaFlex. Sometimes you want to know a little more able why it's failed. There's no point in retrying if your password is wrong, as you may simply lockout the account and have more headaches to sort out.

http://www.talendbyexample.com/talend-tjavaflex-component-reference.html