someName
someName

Reputation: 1273

Are there any alternatives to GSP (General SQL Parser)?

General SQL Parser (GSP) is a quite feature rich SQL parser (to the extent that I have played with it) that allows for modifying SQL statements in a robust way by altering the parse tree itself. Furthermore, it supports SQL flavors for most popular databases. However, a big minus with GSP is that it is horribly, simply horribly, documented: the javadoc's consist mostly of the raw method and property names (with almost no comments), there are really no documentation that outlines the core functionality and the meaning of most important properties and methods; and it seems like they have just exposed everything as public members, making the API very hard to grasp by looking at it. The only documentation is a bunch of practical examples from which you have to reverse-engineer the meaning of the API calls yourself.

I do not like producing production critical software with a library like that. So due to the above, I would prefer using another parser, but have unfortunately failed to find any alternatives (for java) with similar functionality and support for multiple SQL flavors.

Are there any comparable (!) alternatives to GSP for java out there?

Upvotes: 9

Views: 7351

Answers (3)

Lukas Eder
Lukas Eder

Reputation: 220842

jOOQ's parser is an alternative. While jOOQ is historically perceived as an internal DSL that allows for writing type safe, embedded SQL queries in Java, you can also parse all sorts of SQL, procedural code, etc, from and to 30+ RDBMS dialects. and access / transform the resulting expression tree. You can execute it, or just re-generate the SQL.

There are different ways to interact with the parser:

Its documentation is vast, both in terms of the manual and Javadoc. Obviously, the documentation's main purpose is to document the DSL use case, not the parser use case, although for most parser usages this doesn't really matter.

Disclaimer: I work for the company behind jOOQ

Upvotes: 0

James Wang
James Wang

Reputation: 483

I'm James from gudu software(company that developed General SQL Parser). Due to the complexity of SQL language of various databases such as Oracle, SQL Server, DB2, MySQL, Teradata, PostgreSQL, the SQL Parser we created to support those databases was a little bit complicated as well.

I have to admit that the document of General SQL Parser is really poor, Maybe we should put more effort on the document rather than SQL library itself.

Fortunately, we have created a rich set of demos to help people getting started quickly.

If are still interested in using General SQL Parser, please kindly let me know(I can be reached via [email protected]). We are happy to help.

Upvotes: 8

laz
laz

Reputation: 28638

Have you had a look at JsqlParser? I don't know how it compares feature wise, but I've seen it used in production code and it works extremely well.

Upvotes: 2

Related Questions