The JDBC driver returns SQLExceptions for all errors from Derby. If the exception originated in a user type but is not itself an SQLException, it is wrapped in an SQLException. Derby-specific SQLExceptions use SQLState class codes starting with X. Standard SQLState values are returned for exceptions where appropriate.
Unimplemented aspects of the JDBC driver return a SQLException with a SQLState starting with 0A. If your application runs on JDK 1.6 or higher, then the exception class is java.sql.SQLFeatureNotSupportedException. These unimplemented parts are for features not supported by Derby.
Derby supplies values for the message and SQLState fields. In addition, Derby sometimes returns multiple SQLExceptions using the nextException chain. The first exception is always the most severe exception, with SQL-92 Standard exceptions preceding those that are specific to Derby.
For information on processing SQLExceptions, see the Derby Developer's Guide.