This library automatically register p6spy JdbcEventListener
.
When you use p6spy
, SQL calls are automatically traced.
In most usecase, do followings:
- If your DB connection is controlled by servlet container, put p6spy's jar into classpath
- Put p6spy.jar into same place with JDBC driver jar
- Add
p6spy:
prefix to JDBC url- e.g.
jdbc:mysql://
->jdbc:p6spy:mysql://
- e.g.
- If you specified JDBC driver class name in somewhere, replace it with
com.p6spy.engine.spy.P6SpyDriver
- e.g.
com.mysql.jdbc.Driver
->com.p6spy.engine.spy.P6SpyDriver
- e.g.
- Add this JVM system property on startup:
-Dp6spy.config.modulelist=com.p6spy.engine.spy.P6SpyFactory
p6spy
outputs SQL into file by default (modulelist=P6LogFactory)- This option disables P6LogFactory so that it disables SQL log file output
- See p6spy document for detail.
See p6spy document for detail.
As written in p6spy document, p6spy wraps JDBC objects so that casting to driver specific class does not work.
See p6spy document for detail and workaround.