finds.dev← search

// the find

JSQLParser/JSqlParser

★ 5,951 · Java · Apache-2.0 · updated Apr 2026

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

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.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →