Information provided in SQL Exceptions
the message, SQLState values, and error codes in SQL exceptions.
Use the getSQLState
to view the SQLState
and error messages. Use getErrorCode
see the error code. The error code defines the severity of the error and is
not unique to each exception.
Note: Severity is not standardized in Derby.
Applications should not depend on the severity returned from SQL exceptions.
Applications should also check for and process java.sql.SQLWarnings,
which are processed in a similar way. Derby issues
an SQLWarning if the create=true attribute
is specified and the database already exists.
- Example of processing SQLExceptions
A single error can generate more than one SQLException. Use a loop and the getNextException method to process all SQLExceptions in the chain. In many cases, the second exception in the chain is the pertinent one.