1. Java SQL Parser Library

Maven RepoMaven Build StatusCoverage Status Codacy Status Java Docs

JSQLParser is a SQL statement parser built from JavaCC. It translates SQLs in a traversable hierarchy of Java classes.

Latest stable release: JSQLParser-4.5.jar

Development version: JSQLParser-4.6-SNAPSHOT.jar

Sample SQL Statement
SELECT /*+ PARALLEL */
    cfe.id_collateral_ref.nextval
    , id_collateral
FROM (  SELECT DISTINCT
            a.id_collateral
        FROM cfe.collateral a
            LEFT JOIN cfe.collateral_ref b
                ON a.id_collateral = b.id_collateral
        WHERE b.id_collateral_ref IS NULL )
;

SQL Dialects

JSqlParser is RDBMS agnostic and provides support for many dialects such as:

  • Oracle Database

  • MS SqlServer

  • MySQL and MariaDB

  • PostgreSQL

  • H2

Features

  • Comprehensive support for statements:
    • QUERY: SELECT ...

    • DML: INSERT ... INTO ... UPDATE ... MERGE ... INTO ... DELETE ... FROM ...

    • DDL: CREATE ... ALTER ... DROP ...

  • Nested Expressions (e.g. Sub-Selects)

  • WITH clauses

  • Old Oracle JOIN (+)

  • PostgreSQL implicit CAST ::

  • SQL Parameters (e.g. ? or :parameter)

  • Arrays vs. T-SQL Squared Bracket Quotes

  • Fluent API to create SQL Statements from java Code

  • Statement De-Parser to write SQL from Java Objects