|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Multiple SQL Stored Procs being called in Compute Node |
« View previous topic :: View next topic » |
Author |
Message
|
EvolutionQuest |
Posted: Thu Sep 18, 2003 10:01 am Post subject: Multiple SQL Stored Procs being called in Compute Node |
|
|
 Voyager
Joined: 18 Sep 2001 Posts: 88 Location: Billings, MT
|
I have a question concerning calling two or more SQL Stored Procedure calls within one compute node in relation to commits.
I have created a message flow that will call up-to 4 DB2 7.x Stored Procedures which will do inserts, updates, or deletes. Depending on each call it will continue to the next stored procedure call or throw a user execption. I have the Transaction Mode set to Automatic, which from the documentation sounds like a commit would not occur until the end of the message flow. The problem is even when the first stored procedure does a successful insert and the second fails an automatic rollback does not occur. The failure could be from the return code from the stored procedure, or an exception thrown by the compute node.
Even if the stored procedures are split into 4 different compute nodes the problem seems to still be an issue.
Any ideas, experiences, or advice?
Example of SQL Stored Procedure:
DECLARE hello CHARACTER;
DECLARE goodbye CHARACTER;
DECLARE returncode INTEGER;
DECLARE message CHARACTER;
CALL MyStoredProc ( hello, goodbye, returncode, message);
-- If returncode is not equal to zero throw execption and let it rollback
IF (returncode <> 0) THEN
THROW USER EXCEPTION CATALOG 'MyMessage' MESSAGE returncode VALUES (message);
END IF;
CREATE PROCEDURE MyStoredProc ( IN hello CHARACTER, OUT goodbye CHARACTER, OUT returncode INTEGER, OUT message CHARACTER) EXTERNAL NAME "MySchema.MyStoredProc" ;
CALL MyStoredProc1 ( hello, goodbye, returncode, message);
-- If returncode is not equal to zero throw execption and let it all rollback
IF (returncode <> 0) THEN
THROW USER EXCEPTION CATALOG 'MyMessage1' MESSAGE returncode VALUES (message);
END IF;
CREATE PROCEDURE MyStoredProc1 ( IN hello CHARACTER, OUT goodbye CHARACTER, OUT returncode INTEGER, OUT message CHARACTER) EXTERNAL NAME "MySchema.MyStoredProc1" ; _________________ Don't blame technology, for technology was created by humans! |
|
Back to top |
|
 |
Craig B |
Posted: Fri Sep 19, 2003 10:24 am Post subject: |
|
|
Partisan
Joined: 18 Jun 2003 Posts: 316 Location: UK
|
Hi,
Did you have any failure terminals wired, have any TryCatch nodes before these compute nodes, or have the Catch terminal wired in the MQInput node?
If you have any of these wired, then the User Exception you THROW, will be handled by these error handling techniques. If you have chosen to handle these yourself, then you will not get a transactional rollback in your flow. _________________ Regards
Craig |
|
Back to top |
|
 |
EvolutionQuest |
Posted: Fri Sep 19, 2003 11:15 am Post subject: |
|
|
 Voyager
Joined: 18 Sep 2001 Posts: 88 Location: Billings, MT
|
I have the compute node failure wired as well as the mqinput node failure to a subflow which will obtain the error number/message and send it off to a table and queue.
What is sounds like is if the failure terminals are wired it should rollback, correct? How else would I handle it?
Thank you. |
|
Back to top |
|
 |
Craig B |
Posted: Fri Sep 19, 2003 12:08 pm Post subject: |
|
|
Partisan
Joined: 18 Jun 2003 Posts: 316 Location: UK
|
Hi,
If you have wired your failure terminal on the compute node that experiences the error, your exception will be propagated down this path. You are saying you are handling the error and so no transactional rollback occurs.
Please see the other thread we are running on this error handling since this question falls into the same category. _________________ Regards
Craig |
|
Back to top |
|
 |
ndgohel |
Posted: Thu Sep 25, 2003 7:58 am Post subject: Though you have wired failure terminal you can rollback TX |
|
|
 Newbie
Joined: 04 Oct 2002 Posts: 2
|
Dear,
Dont worry if you have wired the failure terminal of Compute node or failure of the input node.
As you told, you have wired the failure terminal of any of those nodes to error subflow. ok then whenever any exception is thrown it will propagate to your error subflow then you can do whatever you want to do with the error. now if you want to rollback the transaction, you must throw user defined exception from your error subflow. so finally the exeception thrown by you in error flow will propage to MQInput node and it will rollback the whole transaction.
try it out and let me know it's worth working.
Regards,
Nilesh D.
IT Analyst, Tata Consultancy Services |
|
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
|
|
|
|