apache > db
Apache DB Project
 
Font size:      

Understanding SQLExceptions

Understanding SQLExceptions

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.

Derby database exceptions are classified by severity. The severity of an SQLException is available through the getErrorCode method call on the SQLException. The severities are summarized below. For more information, check the javadoc for org.apache.derby.types.ExceptionSeverity:

  • Warning Severity--a warning is given but current statement is completed.
  • Statement Severity--the effects of the current statement, if any, on persistent data are undone.
  • Transaction Severity--the effects of the current transaction on persistent data are undone; a rollback is performed.
  • Session Severity--a rollback is performed and the current session is terminated. This closes the current connection.
  • System Severity--the system is shut down. All uncommitted transactions are rolled back.

Unimplemented aspects of the JDBC driver return an SQLException with a message starting "Feature not implemented" and an SQLState of XJZZZ. 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 "Working with Derby SQLExceptions in an Application" in the Derby Developer's Guide.


Previous Page
Next Page
Table of Contents
Index