Using R2dbc transactional and non-transactional on a database connection pool fails for Oracle #31268
Labels
in: data
Issues in data modules (jdbc, orm, oxm, tx)
type: regression
A bug that is also a regression
Milestone
Affects: 6.0.10++
spring boot 3.0.10
oracle-r2dbc 1.1.1
r2dbc-pool 1.0.1.RELEASE
Using R2dbcEntityTemplate to handle CRUD.
Configuring only 1 connection in the pool so the problem occurs directly.
spring.r2dbc.pool.enabled = true
spring.r2dbc.pool.initial-size = 1
Using both @transactional and non transactional transactions on the same pooled oracle connection will result in:
ERROR: "ORA-01453: SET TRANSACTION must be first statement of transaction"
Steps to reproduce:
Step 1: Use a transactional transaction. (set transaction... SQL... commit)
Step 2: Use NON transactional. (SQL...)
Step 3: Use a transactional transaction again. It will fail when trying execute "SET TRANSACTION..."
It looks like auto-commit is causing this. In step 1 auto-commit is true (default for JDBC). When doing a Transaction the auto-commit is set to false so that the transaction logic can be handled manually.
In step 2 you will use the same connection and auto-commit is then false, and no explicit commit is issued.
In step 3 the R2dbcTransactionManager will fail to start a new transaction because of the state of the connection.
spring-r2dbc prior to 6.0.10 works because auto-commit was put back to the original state.
Commit: 9751987 removed this feature.
The text was updated successfully, but these errors were encountered: