Closed manish-in-java closed 7 years ago
JDBC connections usually do not automatically heal from network failures, so the connection pool must figure out if a connection is still valid before handing it over.
BTM provides two ways to recover from network failures: enableJdbc4ConnectionTest
and testQuery
. The former uses the JDBC 4 validation mechanism to test connections and should be preferred, the latter can be used as a fallback when the former doesn't work for whatever reason.
We are using Bitronix
2.1.4
with MySQL connector5.1.39
and Spring Data JPA1.11.4.RELEASE
. Once in a while the app server loses network connectivity to the database server. Once this happens, all connections in the Bitronix pool quickly run into errors. However, they continue to throw errors even after the network connectivity is restored. The following stacktrace appears in the logs:The JDBC URL is
jdbc:mysql://db.domain.com:3306/domain?pinGlobalTxToPhysicalConnection=true
. The data source class name iscom.mysql.jdbc.jdbc2.optional.MysqlXADataSource
.