You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by Apache Wiki <wi...@apache.org> on 2007/04/13 16:46:46 UTC

[Db-derby Wiki] Update of "UnwindExceptionChain" by BryanPendleton

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.

The following page has been changed by BryanPendleton:
http://wiki.apache.org/db-derby/UnwindExceptionChain

The comment on the change is:
Capture useful hint from Dan

New page:
When a problem occurs, Derby throws a SQLException. If you print the exception
message, you may see something like:

 * java.sql.SQLException: Failed to start database 'c:/database', see the next exception for details.

How can you get more information?

SQLException supports a chaining model and Derby uses it when multiple exceptions are involved or more context is needed that just the original exception. Typically the actual problem is the last exception in the chain, displaying the entire chain will make debugging issues much easier. Here's an example of how to walk the chain.

{{{
catch (SQLException e) {
   do {
     System.out.println(e.toString());
     e.printStackStrace(System.out);
     e = e.getNextException();
   } while (e != null);
} 
}}}