AtomikosDataSourceBean example

AtomikosDataSourceBean ds = new AtomikosDataSourceBean();
ds.setUniqueResourceName("postgres");
ds.setXaDataSourceClassName("org.postgresql.xa.PGXADataSource");
Properties p = new Properties();
p.setProperty ( "user" , "java" );
p.setProperty ( "password" , "java" );
p.setProperty ( "serverName" , "localhost" );
p.setProperty ( "portNumber" , "5432" );
p.setProperty ( "databaseName" , "java" );
ds.setXaProperties ( p );
ds.setConnectionPoolSize(5);

Notes

Tested with PostgreSQL 8.2.7 and JDBC driver version 8.3-603.jdbc3

Earlier versions of the driver/DBMS are broken with respect to XA…

To enable XA, set the "max_prepared_transactions" parameter in postgresql.conf. Its value should be at least as large as the "max_connections" value. See this github project for setting up a docker image with PostgreSQL and XA.

Need Help? Start a free trial today!

A free trial of ExtremeTransactions includes support to help you where needed. Apply today to get a kick-start on steroids:

Free Trial

Corporate Information

Atomikos Corporate Headquarters
Hoveniersstraat, 39/1, 2800
Mechelen, Belgium

Contact Us

Copyright 2024 Atomikos BVBA | Our Privacy Policy
By using this site you agree to our cookies. More info. That's Fine