Monitoring and Analyzing database operations-there are many articles on p6spy, SQL profiler, and irontrack SQL. I have done this by referring to http://www.ibm.com/?works/cn/java/j-lo-p6spy,
We use p6spy and irontrack SQL for monitoring.
The online write implementation process is
Download the p6spy package or its source package;
Put the jar package p6spy. jar of p6spy into classpath, if it is a Web application, put it under yourwebapp/WEB-INF/lib/directory;
Put spy. properties under the classpath directory, if the web application is placed in the yourwebapp/WEB-INF/classess/directory, note that not the LIB/directory
Modify the default value of the driver com. p6spy. Engine. Spy. p6spydriver in your application system;
Open the configuration file spy. properties, find the realdriver, and change its value to the real database driver name of your application system;
Run your application or web application. In spy. log, you can see the detailed execution and Operation Records of the SQL statements monitored by p6spy, including the complete SQL Execution parameters.
Download the irontrack SQL file package for installation;
Put irontracksql. jar, p6spy. jar and log4j-1.2.8.jar in classpath, and put the web application in yourwebapp/WEB-INF/lib/directory;
Put spy. properties in the classpath directory, if it is a Web application in yourwebapp/WEB-INF/classess/directory, note that not lib/directory;
Modify the driver name of your database driver to p6spy com. p6spy. Engine. Spy. p6spydriver;
Open the configuration file spy. properties, find the realdriver, and change its value to the real database driver name of your application system;
Set the listening port number to monitorport = 2000;
Run Java-jar irontracksql. jar to start irontrack SQL;
Start your application or server;
You can view and analyze the results on the irontrack SQL graphical interface.
I encountered a problem when referring to the implementation. Follow the instructions below to complete the implementation. You can perform monitoring.
1) set irontracksql. jar, p6spy. jar in the application is placed in yourwebapp/WEB-INF/lib/directory (you need to copy the irontracksql/lib folder and the following JAR into the lib directory, otherwise only rely on irontracksql. jar, p6spy. jar startup will not find the package file );
2) Set spy. properties put in % webapp %/WEB-INF/classess/directory, note that it is not the LIB/directory; (if directly put in the classess/directory, after the project is compiled, no, put it in the xbankmibs2.0dev/src directory, and then automatically put it in the/classess directory after compilation)
I wrote a lot of details on the Internet, but I couldn't do it on my machine according to their steps. Oh, my environment is db9.1, myeclipse6.0, and I can make the above two changes.
In addition, the test found that:
It is not required to start iron tracksql first. Compared with the passive listening of SQL profiler, it takes the initiative to query. It is more suitable for remote monitoring. If you want to start monitoring at any time and close monitoring at all times, you do not need to restart the application once the monitoring window breaks down like SQL profiler. And I think it has less impact on application performance.
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/xiaxiaorui2003/archive/2009/12/01/4915032.aspx