What is this?
Druid is an open-source, high-performance Java database connection pool and SQL parser built by Alibaba's DataWorks team. It combines a JDBC connection pool, a multi-dialect SQL parser/AST analyzer, a SQL firewall, and monitoring statistics into one library.
Is this a standalone app or a library I add to my Java project?
It is a Java library (JAR) you add via Maven, not a standalone application. It ships mainly as the DruidDataSource connection pool plus a separate SQL parser module.
How do I add Druid to my project?
Add the druid Maven dependency directly, or, in a Spring Boot project, use the matching starter: druid-spring-boot-starter for Spring Boot 2.x, druid-spring-boot-3-starter for 3.x, and druid-spring-boot-4-starter for 4.x. You can also instantiate DruidDataSource directly without Spring.
Any pitfall when wiring it into a Spring Boot app?
You must pick the starter that matches your Spring Boot major version (2.x, 3.x, or 4.x) — the three starters are not interchangeable, so using the wrong one will break the integration.
Which SQL dialects does the parser support?
It supports 30 dialects including MySQL, PostgreSQL, Oracle, SQL Server, DB2, ClickHouse, Hive, Spark, Presto, BigQuery, and Snowflake, each with its own lexer, parser, AST, and visitor.
What does the SQL firewall do?
The WallFilter inspects the AST of every SQL statement and blocks SQL injection attempts and other dangerous operations before they reach the database.
Can I monitor the connection pool and SQL execution?
Yes, the built-in StatFilter collects real-time SQL execution and pool statistics and exposes a ready-to-use web monitoring page.
Does Druid support failover across multiple databases?
HighAvailableDataSource adds load balancing, health checks, and automatic failover across multiple underlying data sources.
Which topics is it in?
sql-injection, jdbc, oracle, analysis, health, alibaba, clickhouse, parsing, firewall, spring-boot, parser, high-performance