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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Close the database connection on Job Error/fail

Hi All,
How to close the database connection in the Talend job on job erros. In our job we open a database connection with tMSSqlConnection and at the end of the job we close it. But if some thing goes wrong in the middle of the job, how to close the database connection?
Do talend job will close automatically on error/expcetion ?
I can check on every component on component error and close the connection, but just wondering is there any easy way to close all connections on job exception/error.
Thanks
Ramesh
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,
And one more question is the tPostJob runs even if we check the checkbox (die on error) on any component?

tPostJob and tPreJob can run even if checkout "die on error" on any component, because they are enforcement and can run under any situation in job .
Best regards
Sabrina

View solution in original post

9 Replies
Anonymous
Not applicable
Author

You can use the tPost component to do that.
tPost will always executed even if the job fails.
tPost -> OnComponentOK -> tMSSqlClose
Anonymous
Not applicable
Author

Hi,
Add the reference tPostjob and How to use the tPrejob and tPostjob components into forum. Hope it will be useful.
Best regards
Sabrina
Anonymous
Not applicable
Author

Thanks,
Yes, I am using the tPostJob to close the database connection, now it cleared my doubt that tPostJob will run even on job fail also.
And one more question is the tPostJob runs even if we check the checkbox (die on error) on any component?
Thanks
Ramesh
Anonymous
Not applicable
Author

Hi,
And one more question is the tPostJob runs even if we check the checkbox (die on error) on any component?

tPostJob and tPreJob can run even if checkout "die on error" on any component, because they are enforcement and can run under any situation in job .
Best regards
Sabrina
Anonymous
Not applicable
Author

Thank you verymuch Sabrina.
Ramesh
Anonymous
Not applicable
Author

Hi,
You are welcome, feel free post your issue on forum.
Best regards
Sabrina
Anonymous
Not applicable
Author

May I ask. what to put on code in dynamic settings for toracleclose component.
Thanks,
duffney
Anonymous
Not applicable
Author

Hi duffney,
Would you mind giving us more information about your issue? You want to use dynamic setting(Component List) in component toracleClose?
Best regards
Sabrina
Anonymous
Not applicable
Author

Good morning,
can you please explain me the best practices for using tMSSQLConnection and tMSSQLCommit in ESB jobs, starting with tESBProviderRequest? I have the following doubts related to the topic above:
tPostjob does not work in ESB jobs, it is never triggered. Neither, OnSubjobOk/Error is triggered from tESBProviderRequest. Instead, we use tLogCatcher to catch exceptions and we put tESBProviderFault there. So should we also close the connection there in case of failure? Will the connection remain open forever if we dont close it in this section, or will it recycle then the job is invoked by another request (so that it remains registered within the TalendESBJobFactory? If it remains open, what happends when the underlying network connection gets broken, will it reconnect?
We use the following structure of the web services:
tMSSQLConnection -- onSubJobOK --> tESBProviderRequest --> my logic --> tESBProviderResponse
tLogCatcher --> tXMLMap --> tESBProviderFault or Response (depending on situation)
The same for tRouteInput jobs.
Thanks a lot. Michal
P.S. I know this is a Talend DI section, but the question seems to be relevant to the topic to me 🙂