Configuring PostgreSQL for XA

22 Jul 2015 - 13:22 | Version 9 | | ,

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.

Contact Us

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

E info@atomikos.com
E sales@atomikos.com
T +3215613055

Subscribe to our newsletter

Never miss an update

Copyright 2016 Atomikos BVBA