P6Spy
1.下载p6spy-install.zip
2.将p6spy.jar放到应用的lib目录下,将spy.properties放到WEB-INF\classes目录下
3.修改spy.properties样本的第42行,改为对应驱动,(#部分可以不管)
realdriver=net.sourceforge.jtds.jdbc.Driver
修改spy.properties样本的第54行,封闭缺省的MYSQL驱动:
# the mysql open source driver
# realdriver=org.gjt.mm.mysql.Driver
修改spy.properties样本的第168行,将spy.log放到比较好找的位置:
logfile = E:/spy.log
4.驱动程序加载先后的问题解决
如果spy.log里出现
你的程序的数据库驱动名称 is a real driver in spy.properties, but it has been loaded before p6spy. p6spy will not wrap these connections. Either prevent the driver from loading, or try setting 'deregisterdrivers' to true in spy.properties
请把spy.properties文件里的deregisterdrivers=false改为deregisterdrivers=true,重新运行即可。
5.在spring配置文件中配置如下:
<bean id="dataSource" class=&#