Johan
Johan

Reputation: 76617

Can I perform a transaction across two MySQL databases?

Can I do?

Start transaction;

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

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

commit;

Or will that not work?

Upvotes: 20

Views: 6671

Answers (1)

Mitch Wheat
Mitch Wheat

Reputation: 300579

Yes you can:

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

Upvotes: 16

Related Questions