I post this so that the search engines can pick up on it and maybe it can help somebody out. I had the following issue with the Sybase JDBC driver (jConnect):
I was calling a stored procedure and it was throwing an error. However these errors weren’t propagated to the Java code in form of SQLExceptions, as I was expecting. Things which solved the problem:
- Using .executeUpdate() instead of .execute()
- Using PreparedStatement instead of CallableStatement
- Using the jTDS open-source driver instead of jConnect
None of the solutions are ideal and some are actually counter-intuitive (why should it make a difference if I use .executeUpdate instead of .execute? – the later should be a more generic version of the former). I’m by no means a JDBC expert, so I posted it on stackoverflow.
PS. This is an other reason for using open-source: with it you can at least step trough the code without using tools like JadEclipse (which is a very nice tool btw for decompiling your classes directly from your IDE without any fuss).