Search code examples
jdbcwebspherep6spy

SQL logging in Websphere 6.1


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.


Solution

  • 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.