finds.dev

JSQLParser/JSqlParser

JSqlParser parses an SQL statement and translate it into a hierarchy of Java classes. The generated hierarchy can be navigated using the Visitor Pattern

View on GitHubHomepage ↗

★ 5,951JavaApache-2.0updated Apr 2026

// the take

JSqlParser is a Java SQL parser that turns SQL text into a typed AST you can walk with the Visitor pattern. It's been around for over a decade and covers a wide surface area: MySQL, Postgres, Oracle, SQL Server, BigQuery, Snowflake, DuckDB, and more. If you need to inspect, rewrite, or generate SQL programmatically in a JVM project without pulling in a full query builder, this is the go-to.

The dialect coverage is genuinely impressive — not just SELECT but INSERT, MERGE, DDL, window functions, CTEs, and vendor-specific syntax like Oracle hints and PostgreSQL row-level security policies. The March 2026 performance overhaul is real: the JMH benchmarks show a 10x improvement over 5.3, which had a nasty regression. The fluent builder API for constructing SQL from Java code is a nice addition that most parser-only libraries skip. Dual LGPL/Apache licensing means it's usable in commercial products without the GPL contagion problem.

The Visitor pattern API is verbose and becomes painful quickly — navigating the AST for anything non-trivial means writing a lot of boilerplate adapter classes. Breaking API changes landed in 5.0 (AST Visitor overhaul) with another set expected in 5.4 (JavaCC-8 migration), so if you're not on a recent version you'll have upgrade pain waiting for you. Error recovery is weak: give it subtly malformed SQL or an obscure dialect edge case and you get an exception, not a best-effort parse with a diagnostic. The JDK11+ requirement since 5.0 and JDK17 toolchain for building since 5.1 is a non-issue for most, but a hard wall for anyone maintaining older Java targets.

We read the README, the directory tree and a key source file in July 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
5,951
Forks
1,419
Language
Java
License
Apache-2.0
Last commit
12 Apr 2026

// nearby

If JSqlParser isn't quite it.

All repos →