I'm using the official Sybase JDBC driver to connect to a database and call a stored procedure by creating a CallableStatement, binding the parameters to it and calling .execute() on it.
However, I found that no exception is thrown, even if the stored procedure fails. I can verify that the failure is propagated back to me by sniffing the traffic to the database with Wireshark and observing the error messages coming back.
Finally I found that using .executeUpdate() instead of .execute() does give me the exceptions, however I still have two questions left:
Update: I've tried jTDS, and it behaves correctly (as in: it throws the SQLException in both cases - with .execute() and with .executeUpdate()). However, due to constraints beyond my control, switching out the driver is not really possible.
Also: I'm no interested in the result returned by this stored procedure, it is an insert/update type procedure. I would only be inserted to see (and be able to catch / log) if it fails or not. An other thing I've tried is to get the warnings off the connection after .execute(), but it didn't contain anything either.
Because those Sybase people are crazy, that's why it eats Exceptions! There's no reason to avoid using executeUpdate() for prepared/callable statements. If that's what you've got to use to get it working then go ahead and do so. But you ought to file a bug report with Sybase - there's no reason the driver should be doing that.