It was very interesting when I used the framework from Craftsman Spy. This Framework is very useful for the JDBC Logging with Spring JDBC.
Craftsman Spy is an open source and free framework for JDBC logging, it’s a JDBC driver implementation, you can download it from http://zer0.free.fr/craftsman/spy.php, and also you bind it in your local-Repository for Maven: how it’s work? I will explain it in my next article.
What are the benefits of craftsman Spy?
Spy logger logs all SQL connection and processing’s with executing spent time, all the stored procedures with arguments, all the batch processing’s and the result sets. Craftsman SPY Framework is very helpful for all JunitTests, because you see which runs under the roof and all hidden processes. You can’t find all this facilities in the Spring JDBC Framework, Pity!
How Spring-JDBC works without Spy framework?
You can use the standard JDBCTemplate from Spring like following configuration, which I took it from Spring Data access with JDBC:
And now you can work the Data source like this:
How Spring-JDBC works with Spy framework
It’s very easy to bind the Craftsman Spy and the Spring JDBC framework. You must only bind the download SPY Jar’s from http://zer0.free.fr/craftsman/spy.php or use Maven to get the Jars from your local repository. Second you must only change the Spring-JDBC Configuration:
Change the name of the driverClassName to craftsman.spy.SpyDriver
And you must also change the url to able Spy framework
I hope it was a useful post. 🙂