Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sylcha
Contributor
Contributor

how to Catch error from a tDBOutput caused by a foreign Key

Hi,

i have an API job (Talend Studio 7.3.1) which try to insert data into a table (postgreSQL). There is a FK between this table and an other one. when a line can't be inserted because of the FK how can i trap this event to use it in the API response ? if i plug a tlogrow after my tDBOutput's "onComponentError" he NEVER go in...

but into the execution log i see an "[ERROR] ********tDBOutput******viole la contrainte de clé étrangère « fk_******_ »

thanks for your ideas !

regards,

Sylvain

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hello,

If you would like to catch sql exception in your flow, please try this approach and let me know if it helps:

Check the "Die on error" option.

As all the error message has been included in the SQLException, you do not need to call getNextException() again.

Just handling the current SQLException is enough.

And log4j is also flexible, you could just add more appender in log4j to redirect the error log to the target you want.

Here is also a topic about How to get Call getNextException in talend.

https://community.talend.com/s/question/0D53p00007vCozxCAC/call-getnextexception-in-talend?language=...

Hope it helps for your use case.

Best regards

Sabrina

View solution in original post

2 Replies
ppatel
Contributor III
Contributor III

Hello Team,

 

Could you please check this link :

 

https://community.talend.com/s/question/0D53p00007vCsXgCAK/foreign-key-same-table-error?language=en_US

https://community.talend.com/s/question/0D53p00007vCnXCCA0/can-talend-handle-foreign-key-dependencies?language=en_US

 

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

Anonymous
Not applicable

Hello,

If you would like to catch sql exception in your flow, please try this approach and let me know if it helps:

Check the "Die on error" option.

As all the error message has been included in the SQLException, you do not need to call getNextException() again.

Just handling the current SQLException is enough.

And log4j is also flexible, you could just add more appender in log4j to redirect the error log to the target you want.

Here is also a topic about How to get Call getNextException in talend.

https://community.talend.com/s/question/0D53p00007vCozxCAC/call-getnextexception-in-talend?language=...

Hope it helps for your use case.

Best regards

Sabrina