Spy SQL

A data source wrapper tha allows to get information about JDBC activity

Лицензия

Лицензия

Группа

Группа

io.blep
Идентификатор

Идентификатор

spy-sql
Последняя версия

Последняя версия

0.3
Дата

Дата

Тип

Тип

jar
Описание

Описание

Spy SQL
A data source wrapper tha allows to get information about JDBC activity
Ссылка на сайт

Ссылка на сайт

https://github.com/bleporini/spy-sql
Система контроля версий

Система контроля версий

https://github.com/bleporini/spy-sql

Скачать spy-sql

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.blep/spy-sql/ -->
<dependency>
    <groupId>io.blep</groupId>
    <artifactId>spy-sql</artifactId>
    <version>0.3</version>
</dependency>
// https://jarcasting.com/artifacts/io.blep/spy-sql/
implementation 'io.blep:spy-sql:0.3'
// https://jarcasting.com/artifacts/io.blep/spy-sql/
implementation ("io.blep:spy-sql:0.3")
'io.blep:spy-sql:jar:0.3'
<dependency org="io.blep" name="spy-sql" rev="0.3">
  <artifact name="spy-sql" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.blep', module='spy-sql', version='0.3')
)
libraryDependencies += "io.blep" % "spy-sql" % "0.3"
[io.blep/spy-sql "0.3"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
org.projectlombok : lombok jar 1.12.2
net.jcip : jcip-annotations jar 1.0
org.mockito : mockito-all jar 1.9.5

test (4)

Идентификатор библиотеки Тип Версия
org.easytesting : fest-assert jar 1.4
junit : junit jar 4.11
com.h2database : h2 jar 1.3.164
commons-dbcp : commons-dbcp jar 1.4

Модули Проекта

Данный проект не имеет модулей.

Spy SQL

What is it?

Spy SQL is just a datasource wrapper that allows to hook listeners to monitor DB activity. Its original purpose is to programmatically check the number of JDBC roundtrips and the number or the nature of SQL commands executed by JPA application.

How to use it?

Suppose you're using commons-dbcp, just create a new SpyDatasource with the target datasource :

        final BasicDataSource basicDataSource = new BasicDataSource();
        basicDataSource.setDriverClassName("org.h2.Driver");
        basicDataSource.setUrl("jdbc:h2:mem:sample");
        basicDataSource.setUsername("sa");
        basicDataSource.setPassword("");
        final SpyDatasource spyDs = new SpyDatasource(basicDataSource);

Obviously, it can be used with Spring or any other DI framework.

Then you can register any implementation of the simple interface io.blep.spysql.SqlListener, io.blep.spysql.SqlCounter which is provided or your own:

spyDatasource.addListener(listener);

If your datasource is shared accross multiple threads, beware of concurrency issues as listeners are shared as well. If you're just using it in single treaded test cases, just don't care about it.

Версии библиотеки

Версия
0.3
0.2