Affects Version/s: 1.1.3
Fix Version/s: None
Connector/J supports an optimized "/* ping */" query for validating a
connection when you retrieve a connection out of a connection
pool. This allows you to perform a ping operation at the mysql
protocol layer, without having to actually execute a query like
"select 1" (which in heavy applications may be too much
overhead). This is also documented in a presentation that Mark
Matthews once gave about high-performance with Connector/J, but I
can't seem to find that presentation right now.
This is documented in:
This is something that you would typically use in validationQuery
parameter in a Tomcat DataSource, but unfortunately, they didn't put
it like that in the Connector/J manual
The attached patch implements this also in the MariaDB Java
Client. The patch is sufficient to make this work for the data sources
that I use:
- JBoss 4.0.5
- Apache Commons Database Pool (DBCP) 1.4. DBCP is also the underlying
connection pool library in Tomcat.
The patch does not implement this optimization for prepared
statements, only for normal statements.