DEV.co
Open-Source Observability · jdbc-observations

datasource-proxy

datasource-proxy is a Java library that intercepts and monitors JDBC database connections and queries in real-time. It provides a listener framework to log, measure, and track database interactions without modifying application code.

Source: GitHub — github.com/jdbc-observations/datasource-proxy
768
GitHub stars
82
Forks
Java
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryjdbc-observations/datasource-proxy
Ownerjdbc-observations
Primary languageJava
LicenseMIT — OSI-approved
Stars768
Forks82
Open issues11
Latest releasedatasource-proxy-1.11.0 (2025-07-14)
Last updated2025-07-14
Sourcehttps://github.com/jdbc-observations/datasource-proxy

What datasource-proxy is

A JDBC proxy that wraps DataSource, Connection, Statement, and ResultSet objects to emit events for query execution, timing, and connection lifecycle. Built with zero external dependencies (optional SLF4J) and supports Java 1.6+.

Quickstart

Get the datasource-proxy source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/jdbc-observations/datasource-proxy.gitcd datasource-proxy# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Query Performance Monitoring

Capture execution times, row counts, and query patterns for profiling database bottlenecks and identifying slow queries in production without application changes.

JDBC Audit Logging

Track which queries execute, when, with what parameters, and by whom—useful for compliance, security audits, and debugging unexpected database state changes.

Development & Testing Instrumentation

Observe database behavior during development and test execution; identify N+1 queries, unused connections, or transaction issues early in the development cycle.

Implementation considerations

  • Requires wrapping DataSource at application startup; integration point depends on application factory (Spring, Guice, manual instantiation).
  • No external dependencies by default; using SLF4JQueryLoggingListener requires adding SLF4J to classpath.
  • Listener callbacks are synchronous; long-running listeners (e.g., remote logging) may block query execution—use async wrappers if needed.
  • Sensitive parameter logging requires explicit filtering or custom listeners to avoid credential/PII leakage.
  • Latest release (1.11.0, July 2025) is current; check release notes for breaking changes when upgrading from older versions.

When to avoid it — and what to weigh

  • High-Throughput, Ultra-Low-Latency Applications — Proxy overhead and listener invocation may introduce measurable latency in microsecond-critical workloads; benchmark impact before production deployment.
  • Need for ORM-Level Instrumentation — If you require Hibernate, JPA, or ORM-specific hooks, this JDBC-only proxy does not provide those; consider ORM-native monitoring tools instead.
  • Complex Prepared Statement Parameter Binding — The library logs query strings and parameters; sensitive data (passwords, PII) requires careful configuration to avoid leaking secrets in logs.
  • Proprietary Database Extensions — Works with standard JDBC; vendor-specific extensions (e.g., Oracle-only features) may not be fully observable or may bypass the proxy.

License & commercial use

MIT License (permissive, OSI-approved). Permits commercial use, modification, and distribution with minimal restrictions.

MIT is a permissive license that explicitly allows commercial use. No license cost or vendor lock-in. Review your own legal team if building proprietary closed-source applications, but MIT imposes no commercial restrictions.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

Library itself does not enforce encryption or authentication; it observes JDBC traffic as-is. Primary risk: query parameters and data logged verbatim may expose credentials, PII, or sensitive business logic. Mitigate via custom listeners with filtering/redaction, careful logger configuration, and restricted log access.

Alternatives to consider

Spring Data JDBC Observations / Micrometer

Spring-native observability; integrates with metrics/tracing ecosystems; requires Spring Framework and might be overkill for non-Spring apps.

P6Spy

Similar JDBC proxy with longer history; includes built-in formatting and filtering; slightly heavier footprint and more configuration.

Hibernate / JPA-level monitoring (e.g., Hypersistence Utils)

ORM-aware instrumentation if you use Hibernate; provides semantic insights at entity/session level rather than raw JDBC.

Software development agency

Build on datasource-proxy with DEV.co software developers

datasource-proxy provides lightweight, zero-dependency query observability. Integrate it into your data layer to monitor performance, audit access, and debug database issues—without code changes.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

datasource-proxy FAQ

Does datasource-proxy slow down queries?
Yes, there is proxy overhead (typically low for most workloads). Extent depends on listener complexity and application throughput. Benchmark in your target environment; avoid long-running listeners on query path.
Can I use it with my existing connection pool (HikariCP, Tomcat, etc.)?
Yes. Wrap the pooled DataSource with ProxyDataSource; the proxy sits outside the pool and intercepts connections after acquisition.
How do I avoid logging sensitive data (passwords, API keys)?
Implement a custom QueryExecutionListener that filters/redacts parameters before logging. Do not rely on logger configuration alone.
Is this compatible with Spring Boot?
Yes, but not auto-configured. You must explicitly create and register ProxyDataSource as a bean, or use third-party Spring Boot starter (not in this repo).

Work with a software development agency

Adopting datasource-proxy is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate open-source observability software in production.

Ready to instrument your JDBC layer?

datasource-proxy provides lightweight, zero-dependency query observability. Integrate it into your data layer to monitor performance, audit access, and debug database issues—without code changes.