Hi, I need parser on java that parse SQL and return it as some structure. This structure must have some binding point to what I can bind low level reader.
+1
A:
In case you need to did a little deeper than @Adamski's Zql, take a look at ANTLR, which has grammars for most flavors of SQL.
Nick Holt
2009-09-08 08:36:55
And where I can get an engine that handles: joins, group by, etc? Zql, Antlr are only parsers.
merin
2009-09-08 08:44:30
Have you looked at Apache Derby?
ZZ Coder
2009-09-08 08:50:00
@merin: what do you mean by 'handles'? Do you want to execute the SQL in some way or just get it into some tree structure? It's been a while since I used ANTLR but from memory it will generate an AST that can optionally contain custom nodes.
Nick Holt
2009-09-08 09:08:40
Ya, you right: I want execute SQL, but low level is written by me. I have Paradox db, but my jdbc driver it's a pure java code and it's reads the file structure.I want to end my paradox jdbc driver by supporting of SQL.
merin
2009-09-08 10:34:07
@merin: so if I remember rightly Paradox doesn't support SQL and so what you want to do is process a SQL statement in order to retrieve data from a Paradox DB, right? This is considerably more complicated that simply parsing the SQL, you need to generate, optimize and execute a *query plan*. This first step will be the parsing (which ANTLR will help with) but as I'm not familiar with Paradox I can't really tell you much more than that, other than it'll be quite a task. I'd suggest your time would be better spent getting the data into a modern DB that already supports SQL.
Nick Holt
2009-09-08 13:28:27
You right, but customer has Paradox DB :-( And I have to integrate with this DB.:-(((( I have already wrote jdbc driver which read paradox files in low level. Now my driver supports only simple SQL queries.
merin
2009-09-09 04:52:04
Good luck with that. I'd be tempted to write some code that keeps a Hypersonic DB (or similar) in sync with the Paradox DB, using the SQL engine provided.
Nick Holt
2009-09-09 08:11:34