TransactionScope 不适用于 DB2 提供程序 [英] TransactionScope won't work with DB2 provider
问题描述
我一直在尝试将 TransactionScope 与 DB2 数据库一起使用(使用 DB2 .Net provider v 9.0.0.2 和 c# 2.0)根据 IBM 应该支持.
我已经尝试了所有可以在 IBM 论坛上找到的建议(例如 这里) 无济于事.
我在我的 XP Sp2 机器上启用了 XA 事务,也在 Win 2003 Server 机器上尝试过,但我一直收到臭名昭著的错误:
<块引用>ERROR [58005] [IBM][DB2/NT] SQL0998N 期间发生错误
事务或启发式处理.原因代码 = 16".子代码 =2-80004005".SQLSTATE=58005
Windows 事件日志显示:
<块引用>XA 事务管理器试图加载 XA 资源
管理器 DLL.调用 LOADLIBRARY对于 XA 资源管理器 DLL失败的:DLL=C:APPSIBMDB2v95fp2SQLLIBBINDB2APP.DLL文件=d:comxp_sp2comcom1xdtcdtcxatmsrcxarmconn.cpp行=2467.
另外,授予 NETWORK SERVICE 用户对该文件夹和 dll 的完全权限.
这是 MSDTC 启动消息
<块引用>MS DTC 从以下开始设置:
安全配置(OFF = 0 和开 = 1):交易网络管理 = 0,网络客户端 = 0,使用本机 MSDTC 协议的入站分布式事务 = 0,使用本机 MSDTC 的出站分布式事务协议 = 0,交易互联网协议 (TIP) = 0,XA 交易 = 1
任何帮助将不胜感激!
谢谢,弗洛林
我设法让老旧的 IBM DB2 v7 ODBC 驱动程序在 TransactionScope 中工作.它需要:
- 在 MSDTC 属性中启用 XA 事务
- 在注册表项 HKLMSOFTWAREMicrosoftMSDTCXADLL 下输入的值,名称为DB2CLI.DLL",值为C:PROGRA~1IBMSQLLIBBINDB2CLI.DLL"(dll 的路径8.3 格式 - v9 使用 DB2APP.DLL)
- 重启
- 在释放 TransactionScope 之前未关闭连接.回想起来似乎很明显.:)
我不确定这是否与您的特定场景相关.IBM 文档 将原因代码 16,子代码 2 显示为MSDTC 无法注册 DB2 连接".MSDTC 查找 DB2 dll 似乎存在一些问题 - 也许检查上面引用的注册表项?
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:APPSIBMDB2v95fp2SQLLIBBINDB2APP.DLL File=d:comxp_sp2comcom1xdtcdtcxatmsrcxarmconn.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
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 HKLMSOFTWAREMicrosoftMSDTCXADLL with name 'DB2CLI.DLL' and value 'C:PROGRA~1IBMSQLLIBBINDB2CLI.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?
这篇关于TransactionScope 不适用于 DB2 提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!