Monitor database connections graphically with JBoss and WildFly

User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active

Today I will show how to use a graphical GUI to trace the execution of your Database connection pool running in JBoss AS or WildFly with ton of useful info at your hands.

There are already some nice tools to monitor the execution of your database activity like P6Spy or og4jdbc. However all these nice tools are lacking (at least the last time I've checked them!) some nice GUI interface which can easily let you monitor, sort, filter and easily pinpoint the critical execution paths on your database statements.

Now I'll show you a nice tool that can do this, and also it's free! This framework has been developed by sylvain laurent and it's available on:

You can either pickup the source code or if you are in an hurry (as I am!) you can go for the binaries at:

So, basically you have to install the JDBC Driver on the application server. This driver acts as a bridge towards the real driver so that the information can be sent via sockets on port 4561. The performance JDBC driver is able to reach the real database as it contains the Connection URL of the real database, prefixed by jdbcperflogger: 

So for example, if you are going to connect to an Oracle database available at the URL jdbc:oracle:thin:@host:1521:orcl, then you have to set as JDBC Driver URL:


Now let's see in practice how to use it to trace the execution of the H2 ExampleDS Datasource.

Step #1 Since the JDBC Performance Driver will need to access the real Driver class, we need to make available the com.h2database.h2 module (which contains the H2 Driver). The simplest way to do it, is to make globally available it through the "ee" subsystem. From the CLI execute:

/subsystem=ee:write-attribute(name="global-modules",value=[{"name" => "com.h2database.h2 module","slot" => "main"}])

 (PS the above step is much easier with the Web console Subsystem | Container | EE | Add )

Step #2 Deploy the JDBC Perf Driver

deploy jdbc-perf-logger-driver-0.7.3.jar 

Step #3 Install the datasource pointing to the Driver

data-source add --name=TraceJDBC --driver-class=ch.sla.jdbcperflogger.driver.WrappingDriver --driver-name=jdbc-perf-logger-driver-
0.7.3.jar --connection-url=jdbcperflogger:jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE --user-name=sa --password=sa --jndi-name=java:/tracer

Now the JDBCPerformance Driver will tunnel the db calls to jdbc:h2:mem:test database using the JNDI binding java:/tracer

Step #4 Adjust your applications to use the java:/tracer binding

For example, in an application using persistence.xml to access the H2 datasource:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="" xmlns:xsi="" version="2.0" xsi:schemaLocation="">
   <persistence-unit name="persistenceUnit" transaction-type="JTA">
      <!-- <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source> -->
         <property name="" value="create" />

 Step #5 Start the GUI tool

From the jdbc-perf-logger-gui-0.7.3\bin folder launch:  # linux


jdbc-perf-logger-gui.bat  #windows

 Step #6 Play with your application and enjoy the metrics, like fetch time, thread name, number of connections and more!

jdbc debug sql jboss

Very cool, isn't it ? 

Thanks to sylvain laurent for providing this framework and documentation to get started with it.

Related articles available on

How to deploy a DataSource in jboss at application level ?

  Do you need to deploy your DataSource along with your Enterpri

JBoss Datasource HA

This tutorial has been updated for the new release of JBoss Appli

JBoss run out of Connections ?

Have you got No ManagedConnections available error message ? well

How to connect to a DataSource from a remote client?

  If you want to connect to your JBoss Connection Pool from a re

JBoss Datasource configuration

A Datasource is a Java Naming and Directory Interface (JNDI) obje

How do I get the list of Datasources available ?

JBOSS AS 4/5 Users You can use either twiddle: $ que