There are three types of Java transactions: JDBC Transaction, JTA (Java Transaction API) transaction, container transaction.
A normal transaction supports only one database connection and cannot span multiple databases. The default is to commit the transaction automatically, that is, each updated SQL statement on the database represents a transaction, the system automatically calls commit () after the operation succeeds, or rollback () is called to undo the transaction.
While XA transactions support access to and update data on two or more network computer resources that can be distributed across multiple databases, if you plan to define transactions with JTA, you need to have an implementation javax.sql.XADataSource, The JDBC driver for the javax.sql.XAConnection and Javax.sql.XAResource interfaces. A driver that implements these interfaces will be able to participate in the JTA transaction. A Xadatasource object is a factory of a Xaconnection object, using Usertransaction.begin (), Usertransaction.commit (), and Sertransaction.rollback () to operate
There are three types of Java transactions