Rien Nentjes authored on 16 Jun 2012
.idea Added ext lib dir 11 years ago
conf Added missing build config files 12 years ago
lib Settings in jdbc url, added threads and port settings. Small fixes. 11 years ago
script Settings in jdbc url, added threads and port settings. Small fixes. 11 years ago
src/nl/astraeus/ jdbc Settings in jdbc url, added threads and port settings. Small fixes. 11 years ago
test/nl/astraeus/ jdbc Added dummy test for build 12 years ago
web Web post changes 11 years ago
LICENCE.txt Small changes, added MIT licence 12 years ago
Simple-jdbc-statistics.iml Web post changes 11 years ago
readme.md Settings in jdbc url, added threads and port settings. Small fixes. 11 years ago
readme.md

A simple wrapper around jdbc drivers that will show some statistics about the running queries on a simple web page on port 18080.

See a running example here:

  http://phoibe.astraeus.nl:18080/

To use:

Add the following jars to your classpath:

  • jdbc-stats-0.1.jar
  • slf4j-api-1.6.4.jar (add a slf4j binding if you want to see some logging)
  • ssr-0.5.jar
  • vst-0.5.jar

Add the following jar if you are not running in a web container:

  • servlet-api-2.5.jar

Set your jdbc driver property to the following class:

  nl.astraeus.jdbc.Driver

Add the following to the front of your current jdbc url:

  jdbc:stat:<settings>:
  
  (eg. jdbc:postgresql://localhost/mydb becomes: jdbc:stat::jdbc:postgresql://localhost/mydb)

If you want a login screen add the following instead:

  jdbc:secstat:<settings>:

Use the credentials in your jdbc properties to login

Start your application and goto: http://<host app is running on>:18080/

You will see an overview of the last 2500 queries run on your database and some timing stats about them.

Drivers automatically discovered atm:

  org.postgresql.Driver
  oracle.jdbc.driver.OracleDriver
  com.sybase.jdbc2.jdbc.SybDriver
  net.sourceforge.jtds.jdbc.Driver
  com.microsoft.jdbc.sqlserver.SQLServerDriver
  com.microsoft.sqlserver.jdbc.SQLServerDriver
  weblogic.jdbc.sqlserver.SQLServerDriver
  com.informix.jdbc.IfxDriver
  org.apache.derby.jdbc.ClientDriver
  org.apache.derby.jdbc.EmbeddedDriver
  com.mysql.jdbc.Driver
  org.hsqldb.jdbcDriver
  org.h2.Driver

If yours driver is not in there, make sure it's known before you connect to the database (eg Class.forName("<driver class name>"); )

There are some settings that can be passed in the jdbc url. There is a settings menu where you can change them runtime and it will show you an example for your settings.

Example (default values): webServerConnections=5;numberOfQueries=2500;logStacktraces=true;formattedQueries=true