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 » How to handle commit and rollback in Java method?

Post new topic  Reply to topic
 How to handle commit and rollback in Java method? « View previous topic :: View next topic » 
Author Message
bab
PostPosted: Sun Aug 21, 2016 10:16 pm    Post subject: How to handle commit and rollback in Java method? Reply with quote

Novice

Joined: 05 Jul 2016
Posts: 17

Hi ...

I am trying to commit database connection explicitly inside java method.


I know Compute and Java Compute nodes are handling commit and rollback automatically.

But I need to handle commit and rollback explicitly in java method(Calling java method from ESQL).

I can able to commit and rollback explicitly if i am using Class.forName(DRIVER_NAME) within the same method in java.

I want to do some DML operations in one method and i want commit those transactions in another java method(when the flow gets successful).

Is there any way to commit and rollback explicitly other than the default mode handle by Compute and Java Compute nodes?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Aug 22, 2016 4:06 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You would probably (probably! I don't know for sure) store the JDBC session, so that you could commit it later.

You could also use propagate to send a message downstream, and catch any errors that came back in the original javacompute , and roll back the transaction if an error occurred or commit it if it didn't.

But you would have to make sure that all relevant nodes downstream didn't have automatic transaction turned on.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
bab
PostPosted: Mon Aug 22, 2016 4:34 am    Post subject: Reply with quote

Novice

Joined: 05 Jul 2016
Posts: 17

Thanks for your reply. It could be better if you say how to store session ? Store in global cache or which format?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Aug 22, 2016 5:12 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

bab wrote:
Thanks for your reply. It could be better if you say how to store session ? Store in global cache or which format?


It would be better, I'm sure. But I don't really have an opinion, or solid knowledge.

The global cache can't store objects, as far as I know.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
bab
PostPosted: Mon Aug 22, 2016 9:35 pm    Post subject: Reply with quote

Novice

Joined: 05 Jul 2016
Posts: 17

Yes. You are correct. I tried to storing the connection object inside global cache, it is throwing error.

Looking for alternate solution...
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Aug 23, 2016 3:51 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

bab wrote:
Yes. You are correct. I tried to storing the connection object inside global cache, it is throwing error.

Looking for alternate solution...


Looking where? By asking here? Maybe it's quicker for you to look on IBM's website, in the knowledge center for IIB. Maybe it's quicker for you to use the search function of this website to find previous discussion of the global cache.

No matter what, you should do your own experiments and try several different ways to do what you want. Is the global cache a good choice here? Is it absolutely necessary for what you want to do? Are there other options that may be better?
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
eammnsh
PostPosted: Sat Oct 08, 2016 3:42 am    Post subject: Reply with quote

Apprentice

Joined: 22 Aug 2016
Posts: 29

Just make sure of setting the "jdbcProviderXASupport" value to false in your JDBC configurable service, to be able to commit/rollback your transaction from your java compute nodes.
Back to top
View user's profile Send private message
leron8
PostPosted: Wed Oct 26, 2016 7:14 am    Post subject: Reply with quote

Novice

Joined: 25 Oct 2016
Posts: 20
Location: MX

eammnsh wrote:
Just make sure of setting the "jdbcProviderXASupport" value to false in your JDBC configurable service, to be able to commit/rollback your transaction from your java compute nodes.


This solution worked for me, from IIB 10.0.0.6 and DB2 on an iSeries.
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 » How to handle commit and rollback in Java method?
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.