Package org.javasimon.jdbc4

Simon JDBC 4.1 (Java SE 7) Proxy Driver for monitoring JDBC drivers through the Java Simon API.

See: Description

Package org.javasimon.jdbc4 Description

Simon JDBC 4.1 (Java SE 7) 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.

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 parameter values of monitored entities mentioned earlier.

Simon driver implements just a few basic JDBC interfaces, like Connection and all Statements. 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.jdbc4.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 sufficient 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 setting up 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 org.javasimon.examples.jdbc.Simple and org.javasimon.examples.jdbc.Complex.
Since:
2.4
Author:
Radovan Sninsky, Richard "Virgo" Richter

Copyright © 2019. All rights reserved.