Hello,
I have a JavaBean in my project (non-EJB) that handles all of my database calls. All database calls are done via stored procedures to Sybase 12. I use jConnect 5.2 as the
JDBC driver.
I want to expand my exception handling of SQLExceptions. Currently, I have each call to a stored procedure in a separate method. Each method uses a try/catch/finally block. The resultset, statement, and connection are closed in the finally block. If a SQLException occurs, I catch it as:
with EXCEPTION_MESSAGE defined as:
I would like to expand this catch block to do the following:
-- display the error code and SQL state in addition to the message
-- iterate through the SQLExceptions since there could be multiple chained together
I have also heard of SQLWarnings but I don't know how to "get" them. Can anyone please expand on this?
Furthermore, I would like to know if I can pass the SQLException to a private method to handle the above requirements instead of putting the code in the catch block of each method which calls a stored procedure. This would be much more efficient, as I have many methods.
Taking a try at this, I think that the code I would need to implement would be something like the following:
If anyone could comment on the sample code I have written (if this is even possible) and expand on SQLWarnings, I would appreciate it. Thank you for your time.
[ February 24, 2003: Message edited by: verduka fox ]
[ February 25, 2003: Message edited by: verduka fox ]