I am working at a Spring Java EE application that has to deal with two different datasources, A and B.
As the application needs to update A and B in a consistent way. If one update fails, the whole process fails and a rollback must take place.
I have two different idea on how to implement the application:
- I have to enclose both the updates in a distributed transaction XA. This approach is going to be expensive in terms of performances. Moreover, the B source will be switched off soon, and keeping the whole XA infrastracture could be a bottle neck;
- I could set up an Oracle DB link from db A to db B, and let my application believe that is working just with a single datasource and a local transaction, while Oracle deals with the update synchronization. When B will be switched off, I will simply remove the B update and switch off the DB Link.
What do you think about those two scenario?