Any Java libraries out there that validate SQL syntax? [closed]

Perhaps you can use Antlr, it has a number of SQL grammars and a Java library, as well as plugins for various Java IDEs.

Or as advised, use the parser of open source SQL utilities like SQuirreL SQL Client.


General SQL Parser can do offline SQL syntax check. Supported databases: Oracle, DB2, MySQL, SQL Server, Teradata and PostgreSQL.


I don't think there are such libraries. The SQL syntax has too many derivatives.

A possible solution would be to use parts of an open source pure Java DBMS like SmallSQL. In this project you can create an instance of the SQLParser. The needed references to the connection can be removed very easily.