Today, I changed an old version of the system. Since it was a framework a few years ago, there are fewer people who know more about it, and debugging is a bit difficult. In a permission management system, there are many associated tables, and allCodeThe jar package has been created, and the source code cannot be found. The SQL statement cannot be viewed, but the cause should be a data error. You need to find the database table and link corresponding to the module to find out the problem.
You can use p6spy to search the Internet and output it in the console or log file.ProgramSQL Execution information, and simple configuration for the current simple requirements.
1. Download a p6spyinstall. jar file online. After decompression, you can find the spy. properties and p6spy. Jar files.
For tomcat5.5
Put spy. properties in the {tomcathome}/common/classes folder.
Put p6spy. jar is in the {tomcathome}/common/lib folder.
For Tomcat 6, put both files in the {tomcathome}/lib folder.
2. Modify the location of the data source or database connection defined in the program: Change the <drivername/> General Oracle should be as follows:
<Drivername> oracle. JDBC. Driver. oracledriver </drivername>
To:
<Drivername> com. p6spy. Engine. Spy. p6spydriver </drivername>
3. modify the configuration in the spy. properties file:
Change to realdriver = oracle. JDBC. Driver. oracledriver
The following parts are valid without a well number:
# Specifies the appender to use for logging
# Appender = com. p6spy. Engine. Logging. appender. log4jlogger // use log4j to output SQL
Appender = com. p6spy. Engine. Logging. appender. stdoutlogger // use the console to output
# Appender = com. p6spy. Engine. Logging. appender. filelogger // output to the log file. In addition, the default name of the output file is spy. log.
After the modification, restart the application to view all the executed SQL statements. For more detailed configuration, see:
Http://wenku.baidu.com/view/b68719126edb6f1aff001fb0.html