JDBC and transactions

JDBC API functionality

The transaction scopes in Transaction support map to the following JDBC modes:


Connection autoCommit property set to true.


Connection autoCommit property set to false. The transaction is committed by setting autoCommit to true or calling java.sql.Connection.commit. The transaction can be rolled back by a call to java.sql.Connection.rollback


The XAResource interface provided by an XAConnection is used to control the transaction. Note that XAConnections are available only if Teiid is consumed through its XADataSource, org.teiid.jdbc.TeiidDataSource. JEE containers or data access APIs typically control XA transactions on behalf of application code.

J2EE usage models

J2EE provides the following ways to manage transactions for beans:


The client of a bean begins and ends a transaction explicitly.


The bean itself begins and ends a transaction explicitly.


The application server container begins and ends a transaction automatically.

In any of these cases, transactions may be either local or XA transactions, depending on how the code and descriptors are written. Some kinds of beans (stateful session beans and entity beans) are not required by the specification to support non-transactional sources, although the specification does allow an application server to optionally support this with the caution that this is not portable or predictable. Generally speaking, to support most typical EJB activities in a portable fashion requires some kind of transaction support.

results matching ""

    No results matching ""