Take the 2-minute tour ×

I am looking for a tool that Logs SQL statemetns fired in the application as I use the application.

I found p6spy. But there is an issue with that. It doesnt seem to be compatible with XA Datasources.

Is there a way to make p6spy work on Websphere 6.1 OR is there an alternative to p6spy ?

Also, if anyone has any AspectJ code that intercepts the PreparedStatment object and dumps the SQL, that would also be great.

share|improve this question
add comment

4 Answers

up vote 0 down vote accepted

It does depend on the way that you are accessing the database. If you are using Hibernate then you can make that spit out its SQL, if you are accessing the datasource through WAS then you can use the trace service. Set the trace to something like:

=info: com.ibm.websphere.rsadapter.=detail

And see what you get out of it.

share|improve this answer
thanks Micahel for the info. –  Sathya Jul 14 '09 at 6:49
add comment

It is not mandatory for the JDBC drivers to implement a feature to be able to extract / print out the SQL statements. To be honest, I would do this in database. All reasonable database products can log in detail everything that comes in. Also, you can at the same time get further information like execution plans and their impact on the server.

share|improve this answer
add comment

I seem to remember there being some parameter you can add to your jdbc url configuration, and/or the connection. Can't remember the details.

share|improve this answer
add comment

You shold change trace level into jdbc driver. If you using DB2 then change custom properties for data source
if you using Oracle then change driver on the ojbdc6_g.jar and change JVM properties

share|improve this answer
add comment

Your Answer


