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?
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.