Hi, Is there any sql query validator in frontend side or in any language for validating the query syntax before executing in the database ?.In my current project i have to validate the the sql query in flex before it goes to back end ,coz it has to pass lot many layers before hitting database and the hitting the DB and coming back with an exception is an too expensive process .So im in need of sql query validator in front end side to atleast say its a valid query .
for SQL Parsing at runtime you can look at: SQL4J is a SQL-parser written in Java. http://www.cs.toronto.edu/~jglu/sql4j/index.htm
http://jsqlparser.sourceforge.net/
Perhaps you can use Antlr, it has a number of SQL grammars. http://www.antlr.org/grammar/list
Or as advised, use the parser of open source SQL utilities like SQuirreL SQL Client. http://squirrel-sql.sourceforge.net/
or use parts of an open source pure Java DBMS like SmallSQL. http://www.smallsql.de/
There is Eclipse IDE plugins for validating SQL from IDE.
Check out: http://www.eclipse.org/datatools/
You could grab the SQL BNF grammar and use parser generator to validate input.
I am sure you would have to tweak the standard grammar and this is not trivial. Also, I am sure that you can find something better, but I hope the above will get you somewhere.