Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

JDBC pools configuration

BTM comes bundled with a JDBC XA connection pool. It is very easy to configure it. You basically have to create an instance of bitronix.tm.resource.jdbc.PoolingDataSource set some properties and call init().

Here is an example of datasource creation that connects to an Oracle database:

1. The Bitronix PoolingDataSource is a javabean that implements java.sql.DataSource.
2. You have to specify the driver's XADataSource implementation here.
3. Each datasource must be assigned a unique name. This is required for distributed crash recovery.
4. This datasource will contain 5 connections.
5. You have to set allowLocalTransactions to true if you want to be able to run SQL statements outside of XA transactions scope.
6,7,8. The driverProperties is a java.util.Properties object. You have to add into it a set of property name / property value name of the OracleXADataSource class. You have to refer to the driver's documentation to know what can / has to be set. The OracleXADataSource javadoc contains this list in the Oracle case. BTM will perform conversion from String to boolean or int when necessary.
9,10. You can now use the PoolingDataSource like any other java.sql.DataSource.
11. Remember to close the PoolingDataSource after you're done with it to release the conections.

  • No labels