0 votes
1 view
in SQL by (20.3k points)

Is there an open-source Java library for parsing SQL statements?

If possible, it should be customizable or flexible enough to also be able to parse (or at least ignore) vendor-specific syntax (such as Oracle tablespace definitions or MySQL's LIMIT clause).

If not, strict adherence to the SQL standard is also fine.

Update: I need this for two things:

  • providing an SQL interface to a non-SQL database (mapping to internal API calls)
  • rewriting SQL before it goes to the actual database (e.g. Oracle)

1 Answer

0 votes
by (40.3k points)

ANTLR3 has the ANSI SQL grammar available. You can also use that to create your own parser. Whereas, ANTLR4 has the SQL grammar.

Related questions

0 votes
1 answer
asked Oct 13, 2019 in Java by Ritik (3.5k points)
0 votes
1 answer
asked Sep 29, 2019 in Java by Shubham (3.9k points)
0 votes
1 answer
0 votes
1 answer
+10 votes
2 answers
asked May 30, 2019 in Java by tommas (1k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...