db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Db-derby Wiki] Update of "UnwindExceptionChain" by BryanPendleton
Date Fri, 13 Apr 2007 14:46:46 GMT
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);
} 
}}}

Mime
View raw message