我可以在两个MySQL数据库之间执行事务吗? [英] Can I perform a transaction across two MySQL databases?

查看:378
本文介绍了我可以在两个MySQL数据库之间执行事务吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以吗?

Start transaction;

insert into db1.table1 (field1) values (100),(100);

insert into db2.table2 (field2) values (100),(100);

commit;

还是那行不通?

推荐答案

是的,您可以:

MySQL 5.0.3及更高版本提供 服务器端对XA的支持 交易. 当前,此支持 可用于InnoDB存储 引擎. MySQL XA实现是 基于X/Open CAE文档 分布式事务处理: XA规范.该文件是 由The Open Group和 在
可用 http://www.opengroup.org/public/pubs/catalog/c193.htm . 参考:XA交易

MySQL 5.0.3 and up provides server-side support for XA transactions. Currently, this support is available for the InnoDB storage engine. The MySQL XA implementation is based on the X/Open CAE document Distributed Transaction Processing: The XA Specification. This document is published by The Open Group and available at
http://www.opengroup.org/public/pubs/catalog/c193.htm. Ref: XA Transactions

这篇关于我可以在两个MySQL数据库之间执行事务吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆