Where Am I? Class Hierarchy (JDK) All Classes (JDK) All Fields and Methods (JDK)

Class java.sql.SQLException

java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.sql.SQLException

public class SQLException
extends Exception
super class of:
SQLWarning

The SQLException class provides information on a database access error.

Each SQLException provides several kinds of information:


Constructor Index

SQLException()
Construct an SQLException; reason defaults to null, SQLState defaults to null and vendorCode defaults to 0.
SQLException(String)
Construct an SQLException with a reason; SQLState defaults to null and vendorCode defaults to 0.
SQLException(String, String)
Construct an SQLException with a reason and SQLState; vendorCode defaults to 0.
SQLException(String, String, int)
Construct a fully-specified SQLException

Method Index

getErrorCode()
Get the vendor specific exception code
getNextException()
Get the exception chained to this one.
getSQLState()
Get the SQLState
setNextException(SQLException)
Add an SQLException to the end of the chain.

Constructors

SQLException
 public SQLException(String reason,
                     String SQLState,
                     int vendorCode)
Construct a fully-specified SQLException

Parameters:
reason - a description of the exception
SQLState - an XOPEN code identifying the exception
vendorCode - a database vendor specific exception code
SQLException
 public SQLException(String reason,
                     String SQLState)
Construct an SQLException with a reason and SQLState; vendorCode defaults to 0.

Parameters:
reason - a description of the exception
SQLState - an XOPEN code identifying the exception
SQLException
 public SQLException(String reason)
Construct an SQLException with a reason; SQLState defaults to null and vendorCode defaults to 0.

Parameters:
reason - a description of the exception
SQLException
 public SQLException()
Construct an SQLException; reason defaults to null, SQLState defaults to null and vendorCode defaults to 0.


Methods

getSQLState
 public String getSQLState()
Get the SQLState

Returns:
the SQLState value
getErrorCode
 public int getErrorCode()
Get the vendor specific exception code

Returns:
the vendor's error code
getNextException
 public SQLException getNextException()
Get the exception chained to this one.

Returns:
the next SQLException in the chain, null if none
setNextException
 public synchronized void setNextException(SQLException ex)
Add an SQLException to the end of the chain.

Parameters:
ex - the new end of the SQLException chain

Where Am I? Class Hierarchy (JDK) All Classes (JDK) All Fields and Methods (JDK)