What happens when Connection#close() is called and there is an active local JDBC transaction for non-JTA datasource connection in JBoss?
Issue
- What happens when
Connection#close()is called and there's an active local JDBC transaction for non-JTA datasource in JBoss? - We are using non-JTA datasource (setting
jta="false"to<datasource>) and callingConnection#setAutoCommit(false)to disable auto-commit mode and use local JDBC transaction in our application. When our application callConnection#close()before callingConnection#commit()(orConnection#rollback()) by mistake, it looks the local JDBC transaction is still active in the another requst which uses the returned connection. For example,statement.executeQuery("select current_timestamp;")returns an old timestamp where the previous request start a local JDBC transaction.
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 5.x
- 6.x
- 7.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
