Details
-
Task
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Won't Fix
-
1.1.3
-
None
Description
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:
http://dev.mysql.com/doc/refman/5.5/en/connector-j-usagenotes-j2ee-concepts-connection-pooling.html
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
http://dev.mysql.com/doc/refman/5.5/en/connector-j-usagenotes-tomcat.html
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.
Attachments
Activity
Transition | Time In Source Status | Execution Times |
---|
|
747d 7h 28m | 1 |