DB2Diagnosable interface
The com.ibm.db2.jcc.DB2Diagnosable interface provides a mechanism for getting
DB2 diagnostics from an SQLException.
DB2Diagnosable methods
The following methods are defined only for the IBM Data Server Driver for JDBC
and SQLJ.
getSqlca
Format:
public DB2Sqlca getSqlca();
Returns a DB2Sqlca object from a java.sql.Exception that is produced under a
IBM Data Server Driver for JDBC and SQLJ.
getThrowable
Format:
public Throwable getThrowable();
Returns a java.lang.Throwable object from a java.sql.Exception that is
produced under a IBM Data Server Driver for JDBC and SQLJ.
printTrace
Format:
static public void printTrace(java.io.PrintWriter printWriter,
String header);
Prints diagnostic information after a java.sql.Exception is thrown under a
IBM Data Server Driver for JDBC and SQLJ.
Parameter descriptions:
printWriter
The destination for the diagnostic information.
header
User-defined information that is printed at the beginning of the output.
Related tasks
“Handling an SQLException under the IBM Data Server Driver for JDBC and
SQLJ” on page 77
“Handling SQL warnings in an SQLJ application” on page 155
DB2ExceptionFormatter class
The com.ibm.db2.jcc.DB2ExceptionFormatter class contains methods for printing
diagnostic information to a stream.
DB2ExceptionFormatter methods
The following methods are defined only for the IBM Data Server Driver for JDBC
and SQLJ.
printTrace
Formats:
static public void printTrace(java.sql.SQLException sqlException,
java.io.PrintWriter printWriter, String header)
static public void printTrace(DB2Sqlca sqlca,
344 Application Programming Guide and Reference for Java
™