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 » IBM MQ Java / JMS » MQ transaction in Oracle

Post new topic  Reply to topic
 MQ transaction in Oracle « View previous topic :: View next topic » 
Author Message
pmane
PostPosted: Tue Oct 30, 2001 10:50 pm    Post subject: Reply with quote

Acolyte

Joined: 17 Oct 2001
Posts: 50

I want to pick a message from a queue and put it in a db in single transaction. Is it ture that I need a Web-sphere application server to do that. Can't I use MQ.begin() . Can MQ work as transaction manager ?
Back to top
View user's profile Send private message
UpkarSharma
PostPosted: Wed Oct 31, 2001 12:35 am    Post subject: Reply with quote

Apprentice

Joined: 15 Aug 2001
Posts: 27
Location: Mumbai

1. Retrieving message from a queue and putting in db in a single transaction is very simple.
Get message from the queue and put it in database and if some exception occurrs, use backout() method of MQQueueManager class. This will maintain that data is not lost.
2. For Two Phase transaction, you need one coordinator and other participants. MQSeries can act both as Coordinator and participants.
But MQSeries as coordinator is supported only on certain platforms. On other platforms u will need a transaction manager, which will coordinate Two Phase commit.

[ This Message was edited by: UpkarSharma on 2001-10-31 00:45 ]
Back to top
View user's profile Send private message Send e-mail MSN Messenger
UpkarSharma
PostPosted: Wed Oct 31, 2001 12:43 am    Post subject: Reply with quote

Apprentice

Joined: 15 Aug 2001
Posts: 27
Location: Mumbai

MQ.begin() will be used only if u are performing some functions on the messages. In that case u will put all the actions in a Unit of work and that unit is either committed or backed out. But these calls MQBEGIN, MQCMIT, MQBACK , are supported only on certain platforms.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
middlewareonline
PostPosted: Wed Oct 31, 2001 8:21 am    Post subject: Reply with quote

Acolyte

Joined: 09 Jul 2001
Posts: 73

There are two ways of doing this
1. XA
Setup Queue Manager to be XA coordinator. You will have to enable XA on the datbase you are using (Oracle, SYbase, DB2...NO Microsoft directly but possible through MTS).
Now, in the code you will get handle for db connection through Queue Mangager connect call. You will make future SQL call on this connection (don't do explicit db connect/disconnect). Use MQBEGIN, MQBACK and MQCMIT for UOV.

2. Write a sophasticated logical code in your program, which will take care of 99% situations, if the DB and Queue Manager is running on the same box. The possiblity of failure increases, if they are on distributed system.

Chris
MiddlewareOnline.COM
Back to top
View user's profile Send private message Visit poster's website
pmane
PostPosted: Wed Oct 31, 2001 6:55 pm    Post subject: Reply with quote

Acolyte

Joined: 17 Oct 2001
Posts: 50

I tried to do the same thing . Below is my code

COM.ibm.db2.jdbc.DB2XADataSource ds = new COM.ibm.db2.jdbc.DB2XADataSource();

ds.setDatabaseName("sample");

Connection con = qMgr.getJDBCConnection( ds );

qMgr.begin();
MQPutMessageOptions pmo = new MQPutMessageOptions(); // accept the // defaults,
pmo.options = MQC.MQPMO_SET_IDENTITY_CONTEXT | MQC.MQPMO_SYNCPOINT ;
system_default_local_queue.put(hello_world,pmo);
qMgr.commit();
system_default_local_queue.close();
// Disconnect from the queue manager
qMgr.disconnect();

This gives me error as
MQJE001 : Completion code 1, Reason 2372
When I use mqrc I do not get any info about this.
What is wrong ? the code fails at the line qMgr.begin().





[ This Message was edited by: pmane on 2001-10-31 18:58 ]
Back to top
View user's profile Send private message
EddieA
PostPosted: Thu Nov 01, 2001 7:45 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Hi,

Take a look at: http://www.mqseries.net/phpBB/viewtopic.php?topic=620&forum=12&3

Cheers,

_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
middlewareonline
PostPosted: Thu Nov 01, 2001 10:57 am    Post subject: Reply with quote

Acolyte

Joined: 09 Jul 2001
Posts: 73

Are you sure the call fails at qmgr.begin() and not on previous line where you try to get a connection. Check the DB2 setup for XA. Enable XA trace to see whether Queue Manager is able to open the connection with DB2 or NOT ?

MiddlewareOnlince.com
Back to top
View user's profile Send private message Visit poster's website
arnabkundu
PostPosted: Wed Dec 19, 2001 4:00 am    Post subject: Reply with quote

Newbie

Joined: 25 Sep 2001
Posts: 3

How do I enable XA Trace because I am getting error when i call getJDBCConnection(datasource) in MQQueueManager

[ This Message was edited by: arnabkundu on 2001-12-19 04:01 ]
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 » IBM MQ Java / JMS » MQ transaction in Oracle
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.