We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Transaction Across Two Databases

We are trying to perform several table updates within a transaction, where some of the tables are in one database and some are in a second database, but it seems to be breaking the transaction commit call, and throws an exception. Is it possible to do this? If so, is there something special that needs to be set? I read somewher that this might have to do with using a thread-safe PHP. Is there truth in that? Any help or leads would be appreciated. I have searched the docs, SO and this forum without much success.

Hmmmm, can't you break it down into two transactions?

I believe transactional system requires one centralized system to handle the transaction from the start to the very end. I'm not 100% sure though - never had such a requirement, but big folks like Oracle or MSSQL they don't work in a distributed manner AFAIK, hence transaction must go into one DB.

Thank you, but we would like them all to fail if one fails. If we save successfully a set of records in one DB, then the save of related records in a different DB fails, we'd like to rollback what was done in the first as well.

Hmmmm, can't you break it down into two transactions?

I believe transactional system requires one centralized system to handle the transaction from the start to the very end. I'm not 100% sure though - never had such a requirement, but big folks like Oracle or MSSQL they don't work in a distributed manner AFAIK, hence transaction must go into one DB.