The problem, I think, is that when an exception is thrown, your code throws away all the information in the exception and just displays something generic in the response.
You should at least log the exception before doing that.
The reason I think this is the problem is that when you have "select ... form ..." instead of "select ... from ...", as your posted code does, then an exception will be thrown telling you that your SQL is not well-formed. But since you ignore the exception, you have no way of telling that.