Writing Java in Eclipse, I've recently been bitten by a few trivial bugs where my SQL syntax has been off (e.g., not properly quoting a constant). Are there any tools I could use to help myself catch these as I write them?
+1
A:
IDEA from Intellij 8.x has an SQL parser that can recognize such things (it connects to a datasource that can read your database, and understands that standard JDBC calls inside Java Code have SQL inside their strings and does the SQL syntax highlighting.
There is at least one such pluging for Eclipse (very alpha) but I don't know of any that are even trying to do the highlighting inside the java file the way IDEA does.
In practice, though, unless you are doing direct JDBC interaction, the SQL inside java code has limited usage, as there is often some kind of class in-between, and then IDEA thinks its a plain String.
Yishai
2009-05-01 00:21:48