TransactionScope won't work with DB2 provider

谁都会走 提交于 2019-12-06 07:06:55

问题


I've been trying to use TransactionScope with a DB2 database (using DB2 .Net provider v 9.0.0.2 and c# 2.0) which SHOULD be supported according to IBM.

I have tried all the advice i could find on the IBM forums (such as here) to no avail.

I have enabled XA transactions on my XP Sp2 machine, tried also from a Win 2003 Server machine but i consistently get 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

manager DLL. The call to LOADLIBRARY for the 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.

Also, granted the NETWORK SERVICE user full rights to the folder and dll.

Here's the MSDTC startup message

MS DTC started with the following settings:

Security Configuration (OFF = 0 and ON = 1): Network Administration of Transactions = 0, Network Clients = 0, Inbound Distributed Transactions using Native MSDTC Protocol = 0, Outbound Distributed Transactions using Native MSDTC Protocol = 0, Transaction Internet Protocol (TIP) = 0, XA Transactions = 1

Any help would be much appreciated!

Thanks, Florin


回答1:


I managed to get the creaky old IBM DB2 v7 ODBC driver working in a TransactionScope. It required:

  • XA transactions enabled in MSDTC properties
  • A value entered under the registry key HKLM\SOFTWARE\Microsoft\MSDTC\XADLL with name 'DB2CLI.DLL' and value 'C:\PROGRA~1\IBM\SQLLIB\BIN\DB2CLI.DLL' (path to dll in 8.3 format - v9 uses DB2APP.DLL)
  • A reboot
  • Not closing the connection prior to the TransactionScope being disposed. It seems obvious in retrospect. :)

I'm not sure if this is relevant to your particular scenario. The IBM documentation shows reason code 16, subcode 2 as "The MSDTC is unable to register the DB2 connection." There appears to be some issue with MSDTC finding the DB2 dll - perhaps check the registry key referenced above?




回答2:


I solved this issue by activating MS DTC as in the image below:

  1. run dcomcnfg;
  2. Component Services > Computers > My Computer > Distributed Transaction Coordinator
  3. Select Local DTC > Properties > Security Tab:

Reboot your machine and try again. Make sure you have the latest IBM Drivers. I tested with 10.1 Fix Pack 1 and Informix 11.50.

Source: http://blogs.msdn.com/b/bill/archive/2006/12/12/using-msdtc-between-vista-clients-and-windows-2000-servers.aspx



来源:https://stackoverflow.com/questions/1403946/transactionscope-wont-work-with-db2-provider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!