Powered by Syntax Highlighter scripts!

Configure postgreSQL to XA

Issue:
To store the message after receiving it from the Message Queue, this comes in the XA transaction scope when invoked in websphere application server. the datasource is created using the XA data source provider configured using the postgreSQL XA datasource class.
But after the prepared transaction is executed the exeption below gets thrown in logs. There is no issues when executing the Select queries.

Exception
DSRA0304E:  XAException occurred. XAException contents and details are: The cause is org.postgresql.util.PSQLException: ERROR: prepared transactions are disabled
Error code is: XAER_RMERR (-3).  Exception is: Error preparing transaction
Hint: Set max_prepared_transactions to a nonzero value.
.
Solution
After going through the postgreSQL database documentation got the solution to change the max_prepared_transactions property in the postgresql.conf file. (postgresql.conf file present in the C:\Program Files\PostgreSQL\9.1\data folder if installed in default directory on windows OS).

set the value to 100 for testing the fix. restarted the postgreSQL database by restarting the postgresql service in the windows service. (Type 'services.msc' in the Windows 'Run')