ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Rollback required when calling store procedure

Post new topic  Reply to topic
 Rollback required when calling store procedure « View previous topic :: View next topic » 
Author Message
chetu777
PostPosted: Tue Jan 31, 2012 9:15 pm    Post subject: Rollback required when calling store procedure Reply with quote

Acolyte

Joined: 07 Sep 2009
Posts: 59

Hi All,

In my message flow I am calling a stored procedure.

Now the reuqirement is that they want MB to roll back any operations done by Store procedure(SP) on DB, if SP fails in its operation. They expect this to be done based on the return code or exception thrown by SP back to MB.

The compute node trasaction property being set to "Automatic" can do a Rollback only if MB is excecuting SQL statements on DB directly(at the flow level). But in this case SP is executing the SQL queries on DB.

I can throw exception in flow based on the return code from SP.
But my question is, can we rollback the operations on DB done by SP on DB through MB by throwing any exceptions and not completing the flow???

I guess this is not possible in MB but just checking out if someone has some idea on how to achieve this in MB layer if possible?

Thanks in Advance
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Jan 31, 2012 10:37 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Is the Stored Proc written to provide transactionality?

You can wrap a transactional wrapper around the meat of the SP operations and handle it properly and then return an appropriate error to Broker

There is more to transactionality than just configuring broker.

How you write the SP to give you this functionality will be different for the different DB types.
Speak to your DB Developers. They 'should' know how to write an SP properly.

For example, http://www.4guysfromrolla.com/webtech/080305-1.shtml shows how you can do this with SQL Server
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
jlaisbett
PostPosted: Tue Jan 31, 2012 11:09 pm    Post subject: Reply with quote

Apprentice

Joined: 27 Nov 2009
Posts: 39

In most cases message broker can roll back work done by a stored procedure when using Automatic transaction mode by throwing exceptions appropriately, that functionality is not restricted to direct SQL calls.

We do this and it works perfectly fine although I guess it might depend to a degree how the stored procedures actually work and any transaction management they do themselves.
Back to top
View user's profile Send private message
mgk
PostPosted: Wed Feb 01, 2012 6:20 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Quote:
But my question is, can we rollback the operations on DB done by SP on DB through MB by throwing any exceptions and not completing the flow???


Yes you can, as long as the SP does not try to handle the transaction itself (by commiting or rolling back). Essentially if a flow "ends" with an exception it will rollback any DB work.

Kind regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
chetu777
PostPosted: Wed Feb 01, 2012 8:14 pm    Post subject: Reply with quote

Acolyte

Joined: 07 Sep 2009
Posts: 59

Thank you all for the wonderfull feedback.

I will be able to test the scenarios tommorrow and also I will enquire DBA guys about the trsaction management if done by SP itself.

After looking into the replies above. I am confident of this testing is going to be successfull even if SP is not covering the transaction management also. Will keep you people updated.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Rollback required when calling store procedure
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.