|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
2-phase commit using MQ as XA manager |
« View previous topic :: View next topic » |
Author |
Message
|
rk400 |
Posted: Tue Sep 09, 2003 8:20 pm Post subject: 2-phase commit using MQ as XA manager |
|
|
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 |
|
 |
bower5932 |
Posted: Wed Sep 10, 2003 3:19 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
|
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
|
|
|
|