Wednesday, May 26, 2004

Debugging Tip #2 - P6Spy - A mini review...

Following the excellent comment I got earlier today to my last entry, I took a look at P6Spy - a tool for capturing jdbc information within your application... Looks solid and mature...

For those interested about how it works, it's a proxy pattern - it wrappers your (real) jdbc driver ... so when I call DriverManager.getConnection() it's calling P6Spy's getConnection (which in turn proxies this off to the real driver...) ... all of the sql classes are proxied (ResultSet, etc... ) allowing it to capture as much data as your little heart would desire...

Only caveat was that it didn't work with jdk 1.1.8 ... In fact I'm not sure if it works with anything less than 1.4.x ... but given that it needs to implement / wrapper all of the objects, and given changes in javax.sql.* set of classes as java has evolved you'd need an implementation of P6Spy for each major version (that you cared to support...) so... it's not unexpected that it requires 1.4.x ... Running the new Enterprise version of Fast BugTrack with 1.4.X JVM got everything working fine... Would be nice if they mentioned the required JVM's in the install / troubleshooting section of their docs - but I'm not complaining ;)

Just a note that using tools like these are handy not just for debugging your application, but can also help you identify inefficient SQL or potential bottlenecks that will allow you to optimize your application... The P6Spy log file was (obviously) much easier to read than raw packet data... easy to sort / filter / etc...

0 Comments:

Post a Comment

<< Home