How to Monitor individual methods within the JDBC driver - FollettSchoolSolutions/perfmon4j GitHub Wiki
When you specify –eSQL
option on the perfmon4j java agent command line you can monitor individual method calls on any class that implements the one or more of these JDBC interfaces:
java.sql.CallableStatement
java.sql.Connection
java.sql.Driver
java.sql.PreparedStatement
java.sql.ResultSet
java.sql.Statement
For example if you are using the Microsoft JDBC driver and wanted to know how often this method was called:
com.microsoft.sqlserver.jdbc.SQLServerStatement.processExecuteResults()
You could add the following to your perfmonconfig.xml:
<monitor name='SQL.processExecuteResults'>
<appender name='PUT YOUR APPENDER NAME HERE' pattern="."/>
</monitor>
This is possible because the com.microsoft.sqlserver.jdbc.SQLServerStatement
class implements the java.sql.Statement
interface
Note: Under the -eSQL
option monitoring is grouped only by method name. The package/class name is not included. This means every method with the same name, of every class within a JDBC driver, is captured and reported under the same monitor name.
For example consider the following close
methods on 2 classes that are part of the JDBC driver:
com.microsoft.sqlserver.jdbc.SQLServerStatement.close()
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.close()
If you monitored ‘SQL.close
’ you would get combined counts for invocations across both of these methods (along with any other close methods on any JDBC classes).