File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes JDBC Sybase Stored Procedure Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC Sybase Stored Procedure Exception" Watch "JDBC Sybase Stored Procedure Exception" New topic

JDBC Sybase Stored Procedure Exception

Bruce Walker

Joined: Mar 19, 2004
Posts: 1
I have a JDBC connection to a Sybase database and execute a stored procedure which recognizes that I'm doing something improper so it does a raiseerror. In my Java code the execute is being done in a try block that has a catch (Throwable e) that never gets called. Works fine in Oracle.
What do I need to do on the sybase database?
Sanjay Mathew

Joined: Sep 23, 2004
Posts: 1
I am experiencing the same problem too. When a Sybase stored procedure raises an error of severity > 10, a SQLException is supposed to be thrown by jConnect driver, but if you use CallableStatement.execute() method it does not throw an exception in this case. executeUpdate() will throw a SQLException but executeUpdate() is not supposed to be used for anything which returns a result set.
Anyone who has gotten this to work?
Jan Stanicek

Joined: Aug 05, 2011
Posts: 1
I have met same issue in our app. I created preparedStatement, set all inputs and outputs and execute it. Nothing happen when I threw error inside called SP.
Solution which works for me is add just simple read of output value which throws exception...

It is a pity that after many years this was not fixed in Sybase or its jConnect drivers.
I agree. Here's the link:
subject: JDBC Sybase Stored Procedure Exception
jQuery in Action, 3rd edition