XAPool Examples Description
GenericPool: use of the pool, just to show it is a classical pool
Pool Datasource: a sample to use connection from a datasource
XA Pool Datasource: to get connection which can be used in distributed
transactions (this example comes from JOTM)
MultipleConnection: demonstrate the use of multiple connections in the
same transaction
MultipleTransaction: one connection and multiple transaction
FalseRollback: here no transaction, but a rollback on the connection close()
SaveAutoCommit: save the state of the autocommit flag before the beginnig of the
transaction and restore it after the commit or the rollback of the transaction
SimpleStatement: test the Statement implementation
ds : datasource
utx : UserTransaction
c : Connection
... : means in most of the case, an executeUpdate on a PreparedStatement object
source file: MultipleConnection.java
This example shows how to start a transaction, get and close connections,
and commit or rollback the transaction.
utx.begin();
c = ds.getConnection();
...
c.close();
c = ds.getConnection();
...
c.close();
utx.commit() or utx.rollback();
source file: MultipleConnection.java
This example starts to get a connection, begin and commit a transaction,
and begin and rollback an other one.
c = ds.getConnection();
utx.begin();
...
utx.commit();
utx.begin();
...
utx.rollback();
utx.close();
source file: FalseRollback.java
This example demonstrates that if you set the AutoCommit flag to false, do some
update on your database, and close the connection, all datas are rollbacked. This
example does not use transaction.
c = ds.getConnection();
c.setAutocommit(true);
...
c.close();
c = ds.getConnection();
c.setAutoCommit(false);
...
c.close();
source file: SaveAutoCommit.java
This example shows that the AutoCommit flag is saved and restored after the commit
of the transaction, in our case, autocommit2 and autocommit are equals.
c = ds.getConnection();
c.setAutoCommit(autocommit);
utx.begin();
...
utx.commit();
autocommit2 = c.getAutoCommit();
c.close();
source file: SimpleGenericPool.java
source file: Car.java
source file: SimplePoolHelper.java
source file: StandardPoolDataSourceExample.java
source file: StandardXAPoolDataSourceExample.java
source file: DatabaseHelper.java
source file: SimpleStatement.java
[Last changes: June 04, 2003]