从 .NET 到 DB2 的分布式事务
我有一个问题,我必须调用 AS400 db2 从我的 .net 调用一系列插入/更新存储过程,然后更新一些 SQL2005 表(如果 AS400 db 中的一切都进展顺利)。 我使用的驱动程序没有分布式事务,因此我想知道您是否可以使用任何 IBM iSeries Drivers for DB2 来创建参与分布式事务的 COM+/.NET 组件。 请告诉我是否有人以前做过类似的事情,或者任何指示将不胜感激。
I have a problem where in I have to call into the AS400 db2 to call a series of insert/update stored procedures from my .net and then update a few SQL2005 tables if everything in the AS400 db goes ahead fine. The driver I am using does not have distributed transactions so I was wondering if you can use any of IBMs iSeries Drivers for DB2 to create a COM+/.NET Component which would participate in a distributed transaction. Pls let me know if any one out there has done anything like this before or any pointers would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用哪个驱动程序?
IBM 的 DB2 Connect 支持由 Windows DTC 管理的分布式事务。
Microsoft 的 DB2 驱动程序打包在 Microsoft Host Integration Server 中,也可以执行事务处理。
我从你那里听到了两件事。 您想要执行跨 SQL 和 DB2 的事务。 并且您还想构建一个参与分布式事务的组件。 这些可以一起完成,但前者不需要后者。
使用 .NET 2.0 中的 System.Transactions 类,您可以执行以下操作:
结果将是一个跨越 DB2 和 SQL 的分布式事务,但它不是参与分布式事务的组件,如果您明白我的意思的话。
另一种替代方法是使用 EnterpriseServices/COM+ 模型来定义执行某些操作的组件,并将该组件标记为事务性组件。 这也有效,但不需要在 .NET 中执行分布式事务。
Which driver are you using?
IBM's DB2 Connect supports distributed transactions managed by Windows DTC.
The DB2 driver from Microsoft, which is packaged in Microsoft Host Integration Server, also does transactions.
I am hearing two different things from you. You want to do a transaction that spans SQL and DB2. and also you want to build a component that participates in a distributed transaction. These can be done together but the former does not require the latter.
Using the System.Transactions classes in .NET 2.0, you can do this:
The result will be a distributed transaction that spans DB2 and SQL, but it is not a component that participates in a distributed transaction, if you see what I mean.
The other alternative is to use the EnterpriseServices/COM+ model of defining a component that does something, and marking that component as transactional. This works too, but is not required to do distributed transactions in .NET.