Saturday, August 24, 2019

Difference between XA and Non-XA Datasource


XA Datasource:
  • In simple term, XA datasource is a "global transaction" that may span multiple resources. 
  • An XA transaction involves a coordinating transaction manager, with one or more databases (or other resources, like JMS) all involved in a single global transaction. 
  • It supports two way commit operation.
For an instance:
We have a SOA service updating more than one database table using update queries. If all the queries are dependent on each other and any of the query gets failed while updating table then the whole transaction will be rolled back. So this is a “global transaction”. If we “commit”, it will do commit across all the resources and “rollback” will revert all of the resource’s updates done in the transaction.

Conclusion: It has transaction coordinating manager that allows to handle multiple requests spanning over multiple resources.

Non-XA Datasource:
  • In simple term, Non XA datasource supports “single transaction”or local transactions.
  • Non XA transaction always commit/rollback single resource/operation. 
  • Non-XA transactions have no transaction coordinator, and a single resource is doing all its transaction work itself.
For an instance:
If we have a SOA service updating multiple DB queries independently and there is no relationship in the queries, If any of the queries failed, there will be no impact on other queries and each can be locally committed or rollbacked.

Conclusion: It has no transaction coordinating manager that’s why it can handle one request at a time.

Comparison:
  1. XA datasource support global transaction, so it requires less database transaction compare to Non XA datasource.
  2. If you got multiple requests at a time, there might be a chance of getting Non XA connection pool full and causing failure.

No comments:

Post a Comment

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...