|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
PASSTHRU and Database error handling |
« View previous topic :: View next topic » |
Author |
Message
|
TonyG |
Posted: Tue Jul 16, 2002 1:01 am Post subject: PASSTHRU and Database error handling |
|
|
Newbie
Joined: 16 Jul 2002 Posts: 4 Location: UK
|
I have a query on how MQSI (v2.02) handles application database errors when using the PASSTHRU statement.
I have an example flow which has an Input node a TryCatch node and a Compute node. Within the compute node I attempt to INSERT a text value of 9 characters long into a UDB table column which is defined as VARCHAR(8) .
When I attempt this the message is rolled back to the failure terminal of the Input node and is not caught by the TryCatch node.
If I replace the compute node with a DataBase node and use the same PASSTHRU statement the result is the same.
However if I code the INSERT, without using PASSTHRU, in the Database node then the database error "SQL Native Error Code '-433' " is caught by the TryCatch node and can be handled.
I get the same set of outcomes if I attempt to insert a character string into an INTEGER field.
It seems as though the error handling has been compromised by my choice of using a PASSTHRU statement.
(Interestingly enough if I use PASSTHRU to attempt an INSERT into a non-existent table then the error is correctly thrown and caught )
Has anyone else experienced this problem and is there a fix ?
Thanks
Tony |
|
Back to top |
|
 |
lium |
Posted: Wed Jul 17, 2002 5:46 am Post subject: |
|
|
Disciple
Joined: 17 Jul 2002 Posts: 184
|
I faced the situation in my project. You can do as follows:
For each db operation, you should check the sqlstat. if there is some error,
then you should explicitly throw a user exception.
IF SQLSTATE <> '00000' THEN
THROW USER EXCEPTION MESSAGE 2950 VALUES (SQLERRORTEXT);
END IF;
What is more, you should check off the "Throw exception on database error" of computer node or database node.
regards,
Michael |
|
Back to top |
|
 |
TonyG |
Posted: Wed Jul 17, 2002 9:09 am Post subject: |
|
|
Newbie
Joined: 16 Jul 2002 Posts: 4 Location: UK
|
Michael,
Thanks for your prompt reply.
I think the SQLSTATE is only available in v2.1, also there is no check box "Throw exception on database error" in v2.02
Thanks for the information, this will certainly be useful once we migrate to v2.1.
Does anyone know how to fix this problem in v2.0.2 ?
Tony |
|
Back to top |
|
 |
AlexeiSkate |
Posted: Thu Aug 01, 2002 11:12 am Post subject: |
|
|
Centurion
Joined: 10 Apr 2002 Posts: 123
|
Hi,
I have a question on handling db error isn ESQL.
lium wrote: |
IF SQLSTATE <> '00000' THEN
THROW USER EXCEPTION MESSAGE 2950 VALUES (SQLERRORTEXT);
END IF;
What is more, you should check off the "Throw exception on database error" of computer node or database node.
|
What happens to the message at the point that the THROW statement above is executed ? Does the msg roll back and ends up on a failure queue like the default behavior ? I'm trying to see the advantage of capturing and handling the db error within the compute node itself as oppose to letting the default action take over.
Thanks,
Alex |
|
Back to top |
|
 |
sgopal |
Posted: Thu Aug 01, 2002 11:50 am Post subject: |
|
|
Acolyte
Joined: 30 Jul 2002 Posts: 63
|
Yes, under database exception condition, the message will follow the catch path and it will go to failure queue.
You can also code ESQL to take definite action after capturing the database exception code in compute node.
You will want to code exception handling, if there are business reasons
to do so. For eg., an account number not present may be a valid
condition for your business processing. If you let default error
processing, it will result in failure. If you code your handling, you maybe
able to accept such conditions. |
|
Back to top |
|
 |
kirani |
Posted: Thu Aug 01, 2002 8:56 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Alex,
If you are planning to handle database errors by yourself in the node, you should uncheck "ThrowExceptionOnDatabaseError" box in advanced tab of the node. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|