Package org.javasimon.jdbc

Simon JDBC Proxy Driver for monitoring JDBC drivers through the Java Simon API.

See:
          Description

Class Summary
Driver Simon JDBC Proxy Driver.
Driver.Url Class Url represents Simon JDBC url.
SimonCallableStatement Simon JDBC proxy callable statement implemntation class.
SimonConnection Class implements Simon JDBC proxy connection.
SimonPreparedStatement Simon JDBC proxy prepared statement implementation class.
SimonResultSet Simon JDBC proxy result set implementation class.
SimonStatement Simon JDBC proxy statement implementation class.
SqlNormalizer SqlNormalizer takes SQL statement and replaces parameters with question marks.
 

Package org.javasimon.jdbc Description

Simon JDBC Proxy Driver for monitoring JDBC drivers through the Java Simon API.

Main goal of monitoring the JDBC driver through the Simon JDBC Proxy Driver is to gain data about so-called monitored entities of the JDBC driver, which could provide reasonable information about their usage in the monitored system.

Following JDBC entities are monitored at this time:

Each entity has several monitoring parameters:

Connection:

Statement: SQL command (select, insert, delete, call, ...): SQL: From technical point of view, Simon JDBC Proxy Driver is based on a simple idea of the proxy driver that delegates invocations to the real driver which is wrapped. This allows to intercept invocations to the real driver and measure (or count) them.

However, the goal is not to measure each invocation on every possible function of JDBC driver (there are another techniques like profiling for that purpose), but just monitor those functions of driver which somehow influence paramater values of monitored entities mentioned earlier.

Simon driver implements just a few basic JDBC interfaces, like Connection and all Statments. Rest of the JDBC interfaces (from java.sql.* package) are not implemented by Simon driver. Therefore result of some invocations are not Simon driver classes, but directly classes from real driver. For example, as result of invoke method Connection.createStatement is returned Simon driver class org.javasimon.jdbc.Statement, however result of invoking method Statement.executeQuery is returned concrete implementation class of real driver, i.e. for H2 driver class org.h2.jdbc.JdbcResultSet.

Simons are used to monitor aforementioned entities. To measure time parameters like execution time Stopwatch Simons are used. To count how many statements are open Counter Simons are used.

Each Simon is placed in the tree hierarchy (basic feature of Simon) and the place is strictly defined inside the driver. Therefore you can use static configuration of those Simons by defining their state in the config file (for more information see SimonConfigTest.java example).

Hierarchy of Simons in Simon JDBC proxy driver is following:

org.javasimon.jdbc
 |
 +-> .conn
 |     +-> .commits
 |     +-> .rollbacks
 |
 +-> .stmt
 |     +-> .active
 |
 +-> .sql
 |     +-> .<sql type (select, insert, ...)>
 |           +-> .<sql hash>
For choosing Simon's name is used prefix. If non is defined, default is org.javasimon.jdbc. If default prefix value is not suficient or you need to differentiate between two different drivers (or its configuration) you can define your own prefix as parameter SIMON_PREFIX=<prefix> within JDBC connection string. For example, jdbc:simon:....;SIMON_PREFIX=com.foo.bar. More about setuping Simon JDBC proxy driver see Driver.

For printing information from Simons to standard output you can use:

 SimonUtils.printSimonTree(SimonManager.getRootSimon());
Also see examples classes examples.jdbc.Simple and examples.jdbc.Complex.



Copyright © 2011. All Rights Reserved.