Author |
Message
|
rahulhegde |
Posted: Wed May 07, 2014 1:41 am Post subject: Does XA not work with MQ as TM and ODBC calls for DB2 as RM? |
|
|
Novice
Joined: 06 Jan 2014 Posts: 19
|
Scenario
We are writing linux application to test two-phase commit.
We have used IBM MQ v7.5 as our Transaction Manager and the Resource manager is IBM DB2 v10.1. We have followed the guidelines to add XA Resource Manager information to qm.ini as per IBM help link + added permission connect, DBADM permission grant to mqm user on the database.
Our application uses ODBC Driver call to do all database operations. Property of Autocommit is set to OFF.
Problem
We see upon MQCMIT, the database operation are not commited. We tried the same application using embedded SQL, XA works fine.
Can anyone please help me know what could be the problem?
Last edited by rahulhegde on Wed May 07, 2014 3:00 am; edited 1 time in total |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed May 07, 2014 2:34 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
DB2 V7.1?
Are you sure?
This is really very old. Does the IBM documentation list this version of DB2 as supported for XA? _________________ 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 |
|
 |
rahulhegde |
Posted: Wed May 07, 2014 2:59 am Post subject: |
|
|
Novice
Joined: 06 Jan 2014 Posts: 19
|
Sorry my mistake, this is a Typo. It is IBM DB2 V10.1.
Note - I have changed the Original Thread to have this reflected as IBM DB2 V10.1 |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed May 07, 2014 4:23 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Db2 and MQ are on the same box / appliance?
You do link to the correct libraries in your application /opt/mqm/java/lib[64]/jdbc/db2jdbc.so In case you're using java...
Your switch libraries are defined in the exits?
What does the qmgr startup log say?
You did bounce the qmgr after the change to qm.ini?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rahulhegde |
Posted: Wed May 07, 2014 7:40 am Post subject: |
|
|
Novice
Joined: 06 Jan 2014 Posts: 19
|
Configuation Detail
Host 1 Contains:
- C Application (64 bit),
- IBM DB2 v10.1 Client Library
- IBM MQ v10.5 Server Installation
,
Host 2 Contains
- IBM DB2 v10.1 Server Installation
Switch File
I have used the static registrations' switch file and is compiled using "make -f xaswit.mak db2swits" from location /usr/mqm/samp/xatm/ that generated binary at location /var/mqm/exits64/
note - /usr/mqm/ is the MQ Installation on the Linux Box.
Queue Manager Restart/Logging
Yes, qm.ini was changed and the Queue Manager was restarted.
Tried following recommended XAResourceManager addition as shown:
XAResourceManager:
Name=DBRHEGDE
SwitchFile=db2swits
XAOpenString=dbrhegde,rhegde,rhegde,toc=t
ThreadOfControl=THREAD
where dbrhegde, is the db name and is cataloged on the client side. rhegde/rhegde are credential.
Also tried another XAResourceManager configuration but no luck:
XAResourceManager:
Name=XARHEGDE
SwitchFile=db2swits XAOpenString=AXLIB=/opt/mqm/lib64/libmqmax.so,db=dbrhegde,tpm=mq,HOLD_CURSOR=F,CHAIN_END=F,SUSPEND_CURSOR=F,TOC=P
XACloseString=
ThreadOfControl=PROCESS
I could not see any helpful log using the default configuration @ /var/mqm/errors/. Could you please help if I need to change any configuration to increase the trace level to highest.
Last edited by rahulhegde on Wed May 07, 2014 11:35 am; edited 1 time in total |
|
Back to top |
|
 |
RogerLacroix |
Posted: Wed May 07, 2014 10:38 am Post subject: Re: Does XA not work with MQ as TM and ODBC calls for DB2 as |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
rahulhegde wrote: |
Problem
We see upon MQCMIT, the database operation are not commited. We tried the same application using embedded SQL, XA works fine.
Can anyone please help me know what could be the problem? |
Yes, as per the MQ documentation, you are not to use MQBEGIN, MQCMIT or MQBACK but rather you are to use DB2's commit and backout commands. It is because DB2 will be the external Resource Manager.
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
rahulhegde |
Posted: Wed May 07, 2014 10:54 am Post subject: Re: Does XA not work with MQ as TM and ODBC calls for DB2 as |
|
|
Novice
Joined: 06 Jan 2014 Posts: 19
|
RogerLacroix wrote: |
rahulhegde wrote: |
Problem
We see upon MQCMIT, the database operation are not commited. We tried the same application using embedded SQL, XA works fine.
Can anyone please help me know what could be the problem? |
Yes, as per the MQ documentation, you are not to use MQBEGIN, MQCMIT or MQBACK but rather you are to use DB2's commit and backout commands. It is because DB2 will be the external Resource Manager.
|
I feel there is some understanding gap here - My problem has MQ acts as XA Transaction Manager and DB2 acts as XA Resource Manager.
So if i replace all the ODBC API for database access with Embedded SQL and still have the MQBEGIN and MQCMIT at start and end boundary calls of the DB operations, XA transaction works very well. I need to understand why it doesnt work if I use ODBC API call for database operation.
note - Even the IBM MQ samples shows XA working using Embedded SQL.
Could you please post the link too. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed May 07, 2014 11:16 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
IIRC for this to work as expected you need to have the MQServer and the DB2Server on the same box/appliance.
And please do not disable your BBCodes.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rahulhegde |
Posted: Wed May 07, 2014 11:32 am Post subject: |
|
|
Novice
Joined: 06 Jan 2014 Posts: 19
|
fjb_saper wrote: |
IIRC for this to work as expected you need to have the MQServer and the DB2Server on the same box/appliance.
And please do not disable your BBCodes.  |
Hi - This is not true as
1. I have tried using 'Embedded SQL' where the application is running on Host1 with MQ Manager installed on it and Db2 installed on Host2. XA works fine.
2. Secondly, I have also tried using LIXA - a Third Party XA Transaction Manager where LIXA was installed on Host1 and DB2 on Host2. DB2 was registed as RM to LIXA and application code resided on host1 which had calls to ODBC API. This worked too.
But same XA doesnt work when MQ is used as TM and DB2 calls are made via ODBC API. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed May 07, 2014 1:04 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Like I said, to use MQ as TM you need to have MQ and the DB on the same box. To use MQ as an RM only your TM can be anywhere where it can connect to MQ and your other RMs...
Don't know if you'd be using ODBC if your DB Server is local. This is more for a client setting with a remote DB...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rahulhegde |
Posted: Wed May 07, 2014 8:40 pm Post subject: |
|
|
Novice
Joined: 06 Jan 2014 Posts: 19
|
fjb_saper wrote: |
Like I said, to use MQ as TM you need to have MQ and the DB on the same box. To use MQ as an RM only your TM can be anywhere where it can connect to MQ and your other RMs...
Don't know if you'd be using ODBC if your DB Server is local. This is more for a client setting with a remote DB...  |
this is true, a client-server setting as per configuration detail posted.
Let me try this out. |
|
Back to top |
|
 |
rahulhegde |
Posted: Thu May 08, 2014 9:57 pm Post subject: |
|
|
Novice
Joined: 06 Jan 2014 Posts: 19
|
rahulhegde wrote: |
fjb_saper wrote: |
Like I said, to use MQ as TM you need to have MQ and the DB on the same box. To use MQ as an RM only your TM can be anywhere where it can connect to MQ and your other RMs...
Don't know if you'd be using ODBC if your DB Server is local. This is more for a client setting with a remote DB...  |
this is true, a client-server setting as per configuration detail posted.
Let me try this out. |
XA doesnt work with with all installation on single host - IBM MQ Manager Server, IBM DB2 Server Installation and 64bit C application that uses ODBC API calls (libdb2) |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri May 09, 2014 4:54 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Open a PMR. It should work in this set up. You probably have a set up problem in there...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rahulhegde |
Posted: Fri May 09, 2014 9:49 am Post subject: |
|
|
Novice
Joined: 06 Jan 2014 Posts: 19
|
fjb_saper wrote: |
Open a PMR. It should work in this set up. You probably have a set up problem in there...  |
XA works on two varied configuration at my place, do you still suggest a glitch in a setup problem. I strongly suspect MQ as TM doesnt work with ODBC API. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri May 09, 2014 10:13 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
rahulhegde wrote: |
fjb_saper wrote: |
Open a PMR. It should work in this set up. You probably have a set up problem in there...  |
XA works on two varied configuration at my place, do you still suggest a glitch in a setup problem. I strongly suspect MQ as TM doesnt work with ODBC API. |
My answer would be depends on your ODBC setup. If you do a client setup then no. If you do a server setup (passing info in IPC) it should work... as per manual.
So if it doesn't open a PMR.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|