I'm in a scenario where I have two distinct databases and I want to commit different changes in both database in such a way that if one of the commit fails, the other will also fail.
If I have a 'Transaction A' on 'Database A' and 'Transaction B' on 'Database B', how can I bind the two transactions together so that both will succeed or fail atomically.
I can't figure out a way to do this. It's easy to rollback 'Transaction B' if 'Transaction A' fails, but if 'Transaction B' fails when 'Transaction A' is already committed I'm screwed.
I would like to know if there is a technology to handle this in a specific database product, or even better if there is a generic pattern to handle this scenario that could even be applied to any transactional system such as binding a database transaction with a transactional message queue.