I'm trying to set-up Bitronix in Spring Boot to use last resource gambit with non-XA datasource. Of course by default (autoconfiguration) data source does not participate in XA transaction.
It seems that org.springframework.boot.jta.XADataSourceWrapper
will work only for XADataSource
.
How to connect DataSource
with Bitronix?
Bitronix uses its LrcXADataSource
to implement the last resource gambit. You need to tell Spring Boot to create an XAResource
of that type:
spring.datasource.xa.data-source-class-name=bitronix.tm.resource.jdbc.lrc.LrcXADataSource
You'll also need to set some other properties that will depend on the database you're using and how it's configured. For example, the name of the JDBC driver class:
spring.datasource.xa.properties.driver-class-name=org.hsqldb.jdbcDriver