My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Links

What is this thing?

jdbcGrabber is a thin JDBC wrapper similar to the defunct P6Spy wrapper. With it, you can wrap a vendor's JDBC wrapper in order to capture diagnostic information about what kind of SQL is being executed by your application.

The wrapper's pluggable architecture allows you to develop any kind of "sink" you like to process statements. Its original intention was to reverse engineer legacy applications inside corporations where documentation is scarce and the original developers are gone.

The primary design objective of this wrapper is to be as unobtrusive as possible. It does not use a single external library, so it won't interfere with the libraries your application uses. It can be configured to use a limited size processing queue that dumps out information is a separate thread so it won't slow down your application and won't consume too much memory. It does not modify the byte-code of your application in any way whatsoever.

Out-of-the box the wrapper comes with sinks to print SQL and the stack trace that called it to stdout or to capture it in a file. It also includes command line tools to parse the files and produce nice graphs that show which tables are called from which code branches.

Here is an example of the nice graph you can create with this tool: example graph

Another JDBC wrapper?! Why?

There are several other JDBC wrappers out there, but I created another one for my use for several reasons:

  • Many of those projects are dead or at least haven't been updated in several years
  • Most of those projects are not pluggable, so I can't inject my own, custom analysis code into them at the JDBC "coal face"
  • I wanted a wrapper that didn't have a single runtime dependency on any libraries
  • I wanted a wrapper that didn't touch my byte code (i.e. like many aspect-oriented solutions)
  • I wanted a wrapper oriented more towards figuring out what an application did rather than measuring how fast it executed SQL
  • I wanted to capture stack traces

OK, I'm hooked. How do I use this thing?

In short, you replace your JDBC url and driver class with one that points to jdbcGrabber and the configuration file it should use. So, for example, instead of this:

jdbc:mysql://localhost/test?user=&password=

You'd have this:

jdbc:jdbcGrabber:config=myconfig.properties

Then, in the "myconfig.properties" file you'd (among other things) specify the actual underlying JDBC url like this:

url=jdbc:mysql://localhost/test?user=&password=

Then, in the same "myconfig.properties" file you'd specify how you want jdbcGrabber to behave and where you want it to write out results.

For a full description of how to use jdbcGrabber, check out the UserGuide

Powered by Google Project Hosting