Question

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:

  1. 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;
  2. 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?

Was it helpful?

Solution

A query that uses a DB link will start a distributed transaction in Oracle implicitly. So you get the same overhead as dealing with XA and two datasources from your application.

We are using XA all the time, and it has never been a bottleneck. Don't worry.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top