TransactionScope will not work with DB2 provider
I am trying to use TransactionScope with a DB2 database (using DB2.Net provider v 9.0.0.2 and C # 2.0) which MUST be supported according to IBM.
I have tried all the tips I could find on the IBM forums (like here ) to no avail.
I have enabled XA transactions on my XP Sp2 machine, also tried to start from Win 2003 Server machine, but I keep getting the infamous error:
ERROR [58005] [IBM][DB2/NT] SQL0998N Error occurred during
transaction or heuristic processing. Reason code = "16". Subcode = "2-80004005". SQLSTATE = 58005
The Windows event log says:
The XA Transaction Manager attempted to load the XA resource
DLL manager. LOADLIBRARY call for XA resource manager DLL failed: DLL = C: \ APPS \ IBM \ DB2v95fp2 \ SQLLIB \ BIN \ db2app.dll File = D: \ comxp_sp2 \ com \ com1x \ DTC \ DTC \ XATM \ SRC \ xarmconn.cpp Line = 2467.
In addition, granted the NETWORK SERVICE user full rights to the folder and dll.
Here's a post about running MSDTC
MS DTC started with the following Parameters:
Security Configuration (OFF = 0 and ON = 1): Network Transaction Administration = 0, Network Clients = 0, Inbound Distributed Transactions using Native MSDTC Protocol = 0, Outbound Distributed Transactions using Native MSDTC Protocol = 0, Transaction Protocol (TIP) = 0, Operations XA = 1
Any help would be greatly appreciated!
Thank you Florin
I managed to get a creaky old IBM DB2 v7 ODBC driver working in TransactionScope. This required:
- XA operations are included in MSDTC properties.
- The value entered under the registry key HKLM \ SOFTWARE \ Microsoft \ MSDTC \ XADLL named 'DB2CLI.DLL' and value 'C: \ PROGRA ~ 1 \ IBM \ SQLLIB \ BIN \ DB2CLI.DLL' (path to dll in 8.3 format - v9 uses DB2APP.DLL)
- Reboot
- Do not close the connection until the TransactionScope is placed. This seems obvious in retrospect. :)
I'm not sure if this applies to your specific scenario. IBM documentation shows reason code 16, subcode 2 as "MSDTC could not register a DB2 connection". There seems to be some problem with MSDTC that is finding the DB2 DLL - maybe check the registry key mentioned above?
source to share
I solved this problem by activating MS DTC as shown in the picture below:
- run dcomcnfg ;
- Component Services> Computers> My Computer> Distributed Transaction Coordinator
- Select Local DTC> Properties> Security tab:
Restart your computer and try again. Make sure you have the latest IBM drivers. I've tested with 10.1 Fix Pack 1 and Informix 11.50.
source to share