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.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | jdbc-observations/datasource-proxy |
| Owner | jdbc-observations |
| Primary language | Java |
| License | MIT — OSI-approved |
| Stars | 768 |
| Forks | 82 |
| Open issues | 11 |
| Latest release | datasource-proxy-1.11.0 (2025-07-14) |
| Last updated | 2025-07-14 |
| Source | https://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+.
Get the datasource-proxy source
Clone the repository and explore it locally.
git clone https://github.com/jdbc-observations/datasource-proxy.gitcd datasource-proxy# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
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.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Good |
| Assessment confidence | High |
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.
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.coRelated 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?
Can I use it with my existing connection pool (HikariCP, Tomcat, etc.)?
How do I avoid logging sensitive data (passwords, API keys)?
Is this compatible with Spring Boot?
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.