views:

373

answers:

1

Hi Everyone,

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

A: 

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?

Sam