| Thin wrapper for DB2 "SqlException" and "DB2Sqlca", to make it look like a real Exception with
a working getMessage() that presents the almost-human-readable string hidden in the Sqlca
(what does "CA" stand for, anyway?) instead of the normal random garbage that you get from a DB2
SQLException, like "SQLCode -321, SqlState 32891, SqlErrMc null".
Example usage:
try {
.....
} catch (SQLException ex) {
if (e.getClass().getName().equals("com.ibm.db2.jcc.c.SqlException")) {
throw new DB2SalvageException(e);
}
throw new JspException(e.getMessage());
}
This Exception has been rewritten to use dynamic loading (from class Class) so that it should work fine whether you
have DB2 on your classpath or not; the DB2 drivers are definitely NOT needed to compile this (obviously, the SOFIA
framework could not be allowed to require DB2 drivers in order to compile...).
author: Ian Darwin. |