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. Non-XA transactions have no transaction coordinator, and a single resource is doing all its transaction work itself (this is sometimes called local transactions).
XA and Non XA are transaction protocol for a JDBC data source that determines how the connections are handled from a data source during any transaction.
XA data source In simple term XA datasource supports “global transaction”. It supports two way commit operation. Let’s understand this with an example:
Requirement:
Oracle OSB Proxy service updating more than one database table using update query as shown below example.
If all the three queries are dependent on each other and any of the three 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 handling multiple requests.
Non XA data source:
In simple term Non XA datasource supports “single transaction”. Non XA transaction always commit/rollback single resource/operation.
You can compare Non XA as simple jdbc call in JAVA, we will create one connection and update table than finally release connection for particular query. Let’s understand this with an example:
Requirement:
As per above image, if we want to update all the queries independently, we need to create data source support Non XA transaction.
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