java.sql
Class SQLException

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.lang.Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable 
      extended by java.lang.Exception sample code for java.lang.Exception definition code for java.lang.Exception 
          extended by java.sql.SQLException
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable
Direct Known Subclasses:
BatchUpdateException sample code for java.sql.BatchUpdateException definition code for java.sql.BatchUpdateException , RowSetWarning sample code for javax.sql.rowset.RowSetWarning definition code for javax.sql.rowset.RowSetWarning , SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException , SQLWarning sample code for java.sql.SQLWarning definition code for java.sql.SQLWarning , SyncFactoryException sample code for javax.sql.rowset.spi.SyncFactoryException definition code for javax.sql.rowset.spi.SyncFactoryException , SyncProviderException sample code for javax.sql.rowset.spi.SyncProviderException definition code for javax.sql.rowset.spi.SyncProviderException

public class SQLException
extends Exception sample code for java.lang.Exception definition code for java.lang.Exception

An exception that provides information on a database access error or other errors.

Each SQLException provides several kinds of information:

See Also:
Serialized Form

Constructor Summary
SQLException sample code for java.sql.SQLException.SQLException() definition code for java.sql.SQLException.SQLException() ()
          Constructs an SQLException object; the reason field defaults to null, the SQLState field defaults to null, and the vendorCode field defaults to 0.
SQLException sample code for java.sql.SQLException.SQLException(java.lang.String) definition code for java.sql.SQLException.SQLException(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  reason)
          Constructs an SQLException object with a reason; the SQLState field defaults to null, and the vendorCode field defaults to 0.
SQLException sample code for java.sql.SQLException.SQLException(java.lang.String, java.lang.String) definition code for java.sql.SQLException.SQLException(java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  reason, String sample code for java.lang.String definition code for java.lang.String  SQLState)
          Constructs an SQLException object with the given reason and SQLState; the vendorCode field defaults to 0.
SQLException sample code for java.sql.SQLException.SQLException(java.lang.String, java.lang.String, int) definition code for java.sql.SQLException.SQLException(java.lang.String, java.lang.String, int) (String sample code for java.lang.String definition code for java.lang.String  reason, String sample code for java.lang.String definition code for java.lang.String  SQLState, int vendorCode)
          Constructs a fully-specified SQLException object.
 
Method Summary
 int getErrorCode sample code for java.sql.SQLException.getErrorCode() definition code for java.sql.SQLException.getErrorCode() ()
          Retrieves the vendor-specific exception code for this SQLException object.
 SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException getNextException sample code for java.sql.SQLException.getNextException() definition code for java.sql.SQLException.getNextException() ()
          Retrieves the exception chained to this SQLException object.
 String sample code for java.lang.String definition code for java.lang.String getSQLState sample code for java.sql.SQLException.getSQLState() definition code for java.sql.SQLException.getSQLState() ()
          Retrieves the SQLState for this SQLException object.
 void setNextException sample code for java.sql.SQLException.setNextException(java.sql.SQLException) definition code for java.sql.SQLException.setNextException(java.sql.SQLException) (SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException  ex)
          Adds an SQLException object to the end of the chain.
 
Methods inherited from class java.lang.Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable
fillInStackTrace sample code for java.lang.Throwable.fillInStackTrace() definition code for java.lang.Throwable.fillInStackTrace() , getCause sample code for java.lang.Throwable.getCause() definition code for java.lang.Throwable.getCause() , getLocalizedMessage sample code for java.lang.Throwable.getLocalizedMessage() definition code for java.lang.Throwable.getLocalizedMessage() , getMessage sample code for java.lang.Throwable.getMessage() definition code for java.lang.Throwable.getMessage() , getStackTrace sample code for java.lang.Throwable.getStackTrace() definition code for java.lang.Throwable.getStackTrace() , initCause sample code for java.lang.Throwable.initCause(java.lang.Throwable) definition code for java.lang.Throwable.initCause(java.lang.Throwable) , printStackTrace sample code for java.lang.Throwable.printStackTrace() definition code for java.lang.Throwable.printStackTrace() , printStackTrace sample code for java.lang.Throwable.printStackTrace(java.io.PrintStream) definition code for java.lang.Throwable.printStackTrace(java.io.PrintStream) , printStackTrace sample code for java.lang.Throwable.printStackTrace(java.io.PrintWriter) definition code for java.lang.Throwable.printStackTrace(java.io.PrintWriter) , setStackTrace sample code for java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[]) definition code for java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[]) , toString sample code for java.lang.Throwable.toString() definition code for java.lang.Throwable.toString()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

SQLException sample code for java.sql.SQLException(java.lang.String, java.lang.String, int) definition code for java.sql.SQLException(java.lang.String, java.lang.String, int)

public SQLException(String sample code for java.lang.String definition code for java.lang.String  reason,
                    String sample code for java.lang.String definition code for java.lang.String  SQLState,
                    int vendorCode)
Constructs a fully-specified SQLException object.

Parameters:
reason - a description of the exception
SQLState - an XOPEN or SQL 99 code identifying the exception
vendorCode - a database vendor-specific exception code

SQLException sample code for java.sql.SQLException(java.lang.String, java.lang.String) definition code for java.sql.SQLException(java.lang.String, java.lang.String)

public SQLException(String sample code for java.lang.String definition code for java.lang.String  reason,
                    String sample code for java.lang.String definition code for java.lang.String  SQLState)
Constructs an SQLException object with the given reason and SQLState; the vendorCode field defaults to 0.

Parameters:
reason - a description of the exception
SQLState - an XOPEN or SQL 99 code identifying the exception

SQLException sample code for java.sql.SQLException(java.lang.String) definition code for java.sql.SQLException(java.lang.String)

public SQLException(String sample code for java.lang.String definition code for java.lang.String  reason)
Constructs an SQLException object with a reason; the SQLState field defaults to null, and the vendorCode field defaults to 0.

Parameters:
reason - a description of the exception

SQLException sample code for java.sql.SQLException() definition code for java.sql.SQLException()

public SQLException()
Constructs an SQLException object; the reason field defaults to null, the SQLState field defaults to null, and the vendorCode field defaults to 0.

Method Detail

getSQLState sample code for java.sql.SQLException.getSQLState() definition code for java.sql.SQLException.getSQLState()

public String sample code for java.lang.String definition code for java.lang.String  getSQLState()
Retrieves the SQLState for this SQLException object.

Returns:
the SQLState value

getErrorCode sample code for java.sql.SQLException.getErrorCode() definition code for java.sql.SQLException.getErrorCode()

public int getErrorCode()
Retrieves the vendor-specific exception code for this SQLException object.

Returns:
the vendor's error code

getNextException sample code for java.sql.SQLException.getNextException() definition code for java.sql.SQLException.getNextException()

public SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException  getNextException()
Retrieves the exception chained to this SQLException object.

Returns:
the next SQLException object in the chain; null if there are none
See Also:
setNextException(java.sql.SQLException) sample code for java.sql.SQLException.setNextException(java.sql.SQLException) definition code for java.sql.SQLException.setNextException(java.sql.SQLException)

setNextException sample code for java.sql.SQLException.setNextException(java.sql.SQLException) definition code for java.sql.SQLException.setNextException(java.sql.SQLException)

public void setNextException(SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException  ex)
Adds an SQLException object to the end of the chain.

Parameters:
ex - the new exception that will be added to the end of the SQLException chain
See Also:
getNextException() sample code for java.sql.SQLException.getNextException() definition code for java.sql.SQLException.getNextException()