MySQL 和 MSSQL 之间的分布式事务
我已经尝试了近一周来让分布式事务正常工作。我在 MSSQL 上有一些程序尝试从 MySQL 选择数据。我的需要是在一个(!)事务中完成此操作。当时,我已经使用 OpenLink 的单层 MySQL 驱动程序在 MSSQL 上设置了 ODBC 连接,这表明 XA 事务工作成功(配置 ODBC 连接后集成了一个测试按钮)。然后,我通过 MSDASQL 在 MSSQL 中设置了一个链接服务器到此 ODBC 连接,但是在执行
begin distributed transaction
select * from optin..lu_source_proc
select * from openquery(optinxa, 'SELECT * FROM tbl_source_proc')
commit transaction
此操作时出现错误,无法在实际事务内启动进一步的事务。 (Der OLE DB-Anbieter "MSDASQL" für den Verbindungsserver "optinxa" hat die Meldung "Es können keine weiteren Transaktionen in dieser Sitzung gestartet werden." zurückgeben。
)
另一个测试:
set transaction isolation level serializable
begin transaction
select * from optin..lu_source_proc
select * from openquery(optinxa, 'SELECT * FROM tbl_source_proc')
commit transaction
Der 中的结果用于连接服务器的 OLE DB-Anbieter“MSDASQL” “optinxa” hat die Meldung “[OpenLink][ODBC][Driver]Driver does not support this function” zurückgeben.
但是为什么在配置时声明 ODBC 驱动程序 XA 事务确实有效?
I've tried for nearly a week now to get distributed transactions working. I've some procedures on MSSQL which try to select data from MySQL. My need is to do this in one(!) transaction. At the time I've set up ODBC connection on MSSQL with Single-Tier MySQL driver from OpenLink, which states me, that XA transactions work successfully (there is a test button integrated after configuring ODBC connection). Then I've set up a linked server in MSSQL via MSDASQL to this ODBC connection, but when doing
begin distributed transaction
select * from optin..lu_source_proc
select * from openquery(optinxa, 'SELECT * FROM tbl_source_proc')
commit transaction
I get the error, that no further transaction could be started inside the actual transaction. (Der OLE DB-Anbieter "MSDASQL" für den Verbindungsserver "optinxa" hat die Meldung "Es können keine weiteren Transaktionen in dieser Sitzung gestartet werden." zurückgeben.
)
Another test:
set transaction isolation level serializable
begin transaction
select * from optin..lu_source_proc
select * from openquery(optinxa, 'SELECT * FROM tbl_source_proc')
commit transaction
Results in Der OLE DB-Anbieter "MSDASQL" für den Verbindungsserver "optinxa" hat die Meldung "[OpenLink][ODBC][Driver]Driver does not support this function" zurückgeben.
But why states the ODBC driver on configuring, that XA transactions do work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里有两个重要的方面 -
1)似乎 OLE DB 确实支持分布式事务 - 所以我认为 Microsoft OLE DB Provider for ODBC 数据源也应该...
我还假设如果 MSDASQL 这样做支持分布式事务,那么它将直接处理该功能,而不是将其委托给 ODBC 驱动程序...
在 ODBC 驱动程序中打开分布式事务,
通过调用 -- SQLSetConnectAttr(SQL_ATTR_ENLIST_IN_DTC)
因此,通过 DSN 创建对话框启用 OpenLink 驱动程序日志记录应该帮助确定是否调用 SQLSetConnectAttr(SQL_ATTR_ENLIST_IN_DTC)。
2) 我们需要查看额外的跟踪,以便查看立即导致“驱动程序不支持此功能”错误的 ODBC 活动...
您可以 使用 OpenLink Software 记录支持案例为了更进一步......
There are two important aspects here --
1) It seems that OLE DB does have support for distributed transactions - so I would assume that the Microsoft OLE DB Provider for ODBC Data Sources should too...
I would also assume that if MSDASQL did support distributed transactions then it would handle that functionality directly rather than delegating it to the ODBC Driver...
Distributed transactions are turned on in the ODBC driver by calling --
SQLSetConnectAttr(SQL_ATTR_ENLIST_IN_DTC)
So, enabling OpenLink driver logging via the DSN creation dialogs should help determine whether SQLSetConnectAttr(SQL_ATTR_ENLIST_IN_DTC) is called.
2) We would need to see additional tracing in order to see the ODBC activity immediately leading up to the "Driver does not support this function" error...
You can log a support case with OpenLink Software to take this further...
如果要将 XA 数据源与 Microsoft 分布式事务协调器一起使用,则需要执行以下步骤(MS DTC) 用于处理分布式事务:
另请参阅XA 事务支持需要注册表项,并验证第三方驱动程序 XA DLL 是否创建这些项注册表项。
The following steps are required if you want to use XA data sources together with Microsoft Distributed Transaction Coordinator (MS DTC) for handling distributed transactions:
See also Registry Entries Are Required for XA Transaction Support and validate that the third party driver XA DLL creates these registry entries.