JDBC Instrumentation

Sentry JDBC integration provides the SentryJdbcEventListener for P6Spy database activity interceptor, which creates a span for each JDBC statement executed over a proxied instance of javax.sql.DataSource.


For other dependency managers, check out the central Maven repository.

Configure the DataSource to use com.p6spy.engine.spy.P6SpyDriver as a JDBC driver. For Spring Boot applications:


Add the p6spy prefix to the database connection URL. For Spring Boot applications:

spring.datasource.url: jdbc:p6spy:postgresql://localhost:5432/db

P6Spy uses a Java Service Loader mechanism to register JdbcEventListeners. For more configuration options, check the P6Spy Reference Guide.

In addition to spans, P6Spy logs JDBC statements to a log file by default. Because this file can grow rapidly, we recommend disabling creating a log file by setting a system property p6spy.config.modulelist to com.p6spy.engine.spy.P6SpyFactory or creating a spy.properties file in src/main/resources with the content:

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").