Not what you asked for, but: you can create a PreparedStatement without executing anything. That should
test validity. You still need to connect to a database though.
You could also avoid connection to your "real' database by using an alternate db. Perhaps something like mckoi, which can beeasily packed in a jar file and distributed with the rest of your application. If your target DB is something more powereful, like Oracle for example, you may find that mckoi knows nothing about the high-level features you wish to use. But for parsing simple stuff it may work great.
Otherwise, I think you may find yourself writing your own custom parser. I believe there are varios tools out there that can help you with this (a
Java version of lexx for example) but I'm not too familiar with these currently.