We've written an article that describes how to use JDBC Tools to help analyze performance issues in the data tier using it's query planning capabilities. You can read the article on the Facdatum Blog at: http://www.facdatum.com/database-query-plan-analysis-in-java-applications/
JDBC Tools enables monitoring operations to be plugged into the JDBC layer of a Java application. It comes with pre-defined logging and query planning components, but can be easily configured to support any monitoring code that you want to the JDBC layer.
Version 1.1 of JDBC Tools adds support for MySQL and Microsoft SQL Server to the query planning component, complementing the existing support for Oracle. This release also adds the ability to filter monitoring based on execution time, so exception processing can be controlled when SQL query duration exceeds a specified threshold or has changed significantly from previous execution times.... read more
JDBC Tools Version 1.0.1 has been released. JDBC Tools provides a proxy JDBC driver that can be easily configured to sit between your Java application and the underlying database to allow you to plug in components for monitoring different aspects of the database access.
JDBC Tools comes with some predefined components. Notably a jdbc logger component that will log all interaction with the database and a jdbc query plan explain tool that will generate query plans for each application query as the program is running. However, the real power comes from providing a simple API to allow others to plug in their own monitoring code.... read more