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 » General IBM MQ Support » 2-phase commit using MQ as XA manager

Post new topic  Reply to topic
 2-phase commit using MQ as XA manager « View previous topic :: View next topic » 
Author Message
rk400
PostPosted: Tue Sep 09, 2003 8:20 pm    Post subject: 2-phase commit using MQ as XA manager Reply with quote

Apprentice

Joined: 04 Mar 2003
Posts: 27

Hi,

We've written a sample program implementing 2-phase commit.
try
{
qMgr.begin();
}
catch(MQException me)
{
if((me.completionCode == me.MQCC_WARNING)||(me.reasonCode == me.MQRC_NO_EXTERNAL_PARTICIPANTS )){
}
else{
throw me;
}
}
con = qMgr.getJDBCConnection((javax.sql.XADataSource)getDataSource());
con.setAutoCommit(false);
MQQueue local_queue = mqp.openQToGet(lQueue,qManager,qMgr);
String strRcvdMsg = mqp.getMessageQ(local_queue);
PreparedStatement stmt = con.prepareStatement("INSERT INTO MSGTBL VALUES(?,?)");
stmt.setInt(1,msgseq);
stmt.setString(2,strRcvdMsg);
stmt.executeQuery();
qMgr.commit();
con.close();

}


Questions:

1. Do we need to get the connection using qmgr.getJDBCconnection() for every message.
2. Do we need to close the connection for every message.

thanx in adv
RK
Back to top
View user's profile Send private message
bower5932
PostPosted: Wed Sep 10, 2003 3:19 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

Go take a look at mqdb2log.java out on:

http://www.developer.ibm.com/tech/sampmq.html

I think it can answer your questions. It is in the middle of the page in the java section.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » 2-phase commit using MQ as XA manager
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.