One Star

tMysqlRow - how to capture sql error

Hi!
I am using tMysqlRow component and when there is an error in SQL, the return code of the component is 0. This is problematic since I have subsequent jobs that have a dependency on the success of this job.
To replicate, in a tMysqlRow component, write a simple insert sql with syntax error. Run the job. In the console, the error is shown but the exit code is 0.
Thanks,
Sarah
5 REPLIES
Community Manager

Re: tMysqlRow - how to capture sql error

Hello
There is a 'die on error' option on the component, uncheck this option. The job will capture the exception and continue to process the next subJobs.
If there is a syntax error in the sql, the job can't run as there are some compilation error in generated code. You should correct the compilation error first.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: tMysqlRow - how to capture sql error

Thanks shong. Sure, syntax error should be fixed. but a more realistic error is at runtime, such as unique constraint / integrity contraint that can only be known at runtime. But based on your suggestion, 'die on error' will not stop the entire job in this particular case, it will only capture the exception. So does that mean that it won't have an exit code of 1? thanks!
Community Manager

Re: tMysqlRow - how to capture sql error

Hello
'die on error' will not stop the entire job in this particular case, it will only capture the exception. So does that mean that it won't have an exit code of 1? thanks!

yes, there is not exception message printted on console and the job works fine, the exit code will be 0.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: tMysqlRow - how to capture sql error

Shong, I misunderstood your statement. I do want the job to fail if there is any error thrown in that component during runtime. so I should check 'die on error'.
thanks.
Community Manager

Re: tMysqlRow - how to capture sql error

Hello
I do want the job to fail if there is any error thrown in that component during runtime. so I should check 'die on error'.

Yes. Smiley Happy
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business