Overview of SQLException
by, 03-10-2012 at 07:57 AM (987 Views)
Opposed to Exception, SQL Exception’s instance is thrown when an error occurs with JDBC while doing communication with data source. Data source is the database presentation to which connection is been made to an application.
Error’s root cause is determined by the useful information that is given in SQLException.
- An error’s description: Method SQLException.getMessage() returns the string, which details the error.
- A SQL state code. Codes are ISO/ANSI standardized. Five alphanumeric code is returned by SQLException.getSQLState()
- An error code. The instance of SQLException which is thrown is recognised by integer value code. Its meaning & value are specific for implementation. SQLException.getErrorCode() returns the error code.
- A cause. One or more Throwable objects are present in which possess a casual relationship. SQLException.getCause()returns the causes that are navigated recursively, till null value gets returned.
- Reference to chain exceptions. The reference of exceptions via this chain, when there is more than one error. The SQLException.getNextException() obtains the next exception, in this chain.