See: Description
Class | Description |
---|---|
Driver |
Simon JDBC 4.1 Proxy Driver (Java SE 7).
|
SimonCallableStatement |
Simon JDBC proxy callable statement implementation class.
|
SimonConnection |
Class implements Simon JDBC proxy connection.
|
SimonConnectionConfiguration |
JDBC configuration contains Simon JDBC connection URL, real JDBC connection URL and Simon properties.
|
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.
|
WrapperSupport<D extends Wrapper> |
Helper class for implementing
Wrapper on wrappers. |
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:
Connection:
close
was not invoked);
getConnection
and close
;
commit
- this counter is increased
only by invoking method commit
, therefore if autocommit is true counter is not representative;
rollback
- this counter is
increased only by invoking method rollback
, therefore if autocommit is true counter is not
representative.
close
was
not invoked;
createStatement
,
prepareStatement
or prepareCall
and close
);
executeQuery
, executeUpdate
or execute
;
executeQuery
, executeUpdate
or execute
);
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
.Copyright © 2019. All rights reserved.