Introducing JDBCSpy
05 Nov 2007More for personal interest than anything else but I’ve decided to re-write and open-source part of what I worked on for the last hack day.
I’ve called it JDBCSpy and it’s available over on Google Code. It’s worth noting that there are a couple of other projects that also aim to accomplish more or less similar things, notably P6Spy and JAMon. Unfortunately it doesn’t look like P6Spy has had any active development done on it in the past 3 or 4 years. The last time I checked it also had a rather cryptic set of dependencies (that had to be downloaded separately and put on the compilation classpath) and an overly complicated build. Essentially, JDBCSpy aims to provide similar functionality but in an easily packaged driver that exposes information via JMX. There will also be a standalone viewer that can visualize the information as it’s being gathered.
Objective
JDBCSpy aims to provide a lightweight means to obtain statistics at the JDBC driver level.
*Status
*
It currently provides minimal statistics around JDBC Statements and PreparedStatements but functionality is expected to improve over time.
JDBCSpy has been tested using PostgreSQL and hsqldb but should more or less work with any configurable JDBC data source.
*Dependencies
*
There are no run-time dependencies. JDBCSpy has test-time dependencies on TestNG and hsqldb.
*Future Plans
*
* Support for more Statement/PreparedStatement? methods (currently only tracks executeQuery())
* Provide a nice UI for statistics visualization (Currently in progress, a Queries per Second chart has now been committed)
All in all, pretty basic stuff but it’s given me an opportunity to play a bit more with Maven and learn more about JDBC internals. It’s far from production right now but should provide useful foundation for future enhancements.
Note to self: Maven makes life so much simplier. There’s nothing better than: mvn idea:idea