JDBC spy/profiler
P6Spy is an Open-Source framework to intercept JDBC database statements, which apparently works as a wrapper around your real JDBC driver. Cool!
Out-of-the box applications include logging and monitoring for "dead" statements, and the Jahia people have released an SQL profiling tool based on this framework.
Thanks Markus for the tip!