public class SQLException extends Exception implements Serializable, Iterable<Throwable>
SQLState
error description string following either
SQL 99 or X/OPEN SQLState
conventions. DatabaseMetaData.getSQLStateType()
exposes the specific convention in
use.DatabaseMetaData
,
Serialized FormConstructor and Description |
---|
SQLException()
Creates an
SQLException object. |
SQLException(String theReason)
Creates an
SQLException object. |
SQLException(String theReason,
String theSQLState)
Creates an
SQLException object. |
SQLException(String theReason,
String theSQLState,
int theErrorCode)
Creates an
SQLException object. |
SQLException(String theReason,
String theSQLState,
int theErrorCode,
Throwable theCause)
Creates an SQLException object.
|
SQLException(String theReason,
String theSQLState,
Throwable theCause)
Creates an SQLException object.
|
SQLException(String theReason,
Throwable theCause)
Creates an SQLException object.
|
SQLException(Throwable theCause)
Creates an SQLException object.
|
Modifier and Type | Method and Description |
---|---|
int |
getErrorCode()
Returns the integer error code for this
SQLException . |
SQLException |
getNextException()
Retrieves the
SQLException chained to this SQLException ,
if any. |
String |
getSQLState()
Retrieves the
SQLState description string for this SQLException object. |
Iterator<Throwable> |
iterator()
Obsolete.
|
void |
setNextException(SQLException ex)
Obsolete.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public SQLException()
SQLException
object. The reason string is set to
null
, the SQLState
string is set to null
and the
error code is set to 0.public SQLException(String theReason)
SQLException
object. The reason string is set to the given
reason string, the SQLState
string is set to null
and the error code is
set to 0.theReason
- the string to use as the Reason stringpublic SQLException(String theReason, String theSQLState)
SQLException
object. The reason string is set to the
given reason string, the SQLState
string is set to the given
SQLState
string and the error code is set to 0.theReason
- the string to use as the reason string.theSQLState
- the string to use as the SQLState
string.public SQLException(String theReason, String theSQLState, int theErrorCode)
SQLException
object. The reason string is set to the
given reason string, the SQLState
string is set to the given
SQLState
string and the error code is set to the given error code
value.theReason
- the string to use as the reason string.theSQLState
- the string to use as the SQLState
string.theErrorCode
- the integer value for the error code.public SQLException(Throwable theCause)
theCause
- the Throwable object for the underlying reason this
SQLExceptionpublic SQLException(String theReason, Throwable theCause)
theReason
- the string to use as the Reason stringtheCause
- the Throwable object for the underlying reason this
SQLExceptionpublic SQLException(String theReason, String theSQLState, Throwable theCause)
theReason
- the string to use as the Reason stringtheSQLState
- the string to use as the SQLState stringtheCause
- the Throwable object for the underlying reason this
SQLExceptionpublic SQLException(String theReason, String theSQLState, int theErrorCode, Throwable theCause)
theReason
- the string to use as the Reason stringtheSQLState
- the string to use as the SQLState stringtheErrorCode
- the integer value for the error codetheCause
- the Throwable object for the underlying reason this
SQLExceptionpublic int getErrorCode()
SQLException
.SQLException
. The meaning
of the code is specific to the vendor of the database.public SQLException getNextException()
SQLException
chained to this SQLException
,
if any.SQLException
chained to this SQLException
.
null
if there is no SQLException
chained to this
SQLException
.public String getSQLState()
SQLState
description string for this SQLException
object.SQLState
string for this SQLException
object.
This is an error description string which follows either the SQL
99 conventions or the X/OPEN SQLstate
conventions. The
potential values of the SQLState
string are described in
each of the specifications. Which of the conventions is being
used by the SQLState
string can be discovered by using
the getSQLStateType
method of the DatabaseMetaData
interface.public void setNextException(SQLException ex)
ex
to the end of this chain.public Iterator<Throwable> iterator()
Throwable.getCause()
should be used instead of this iterator. Returns an iterator
over the exceptions added with setNextException(java.sql.SQLException)
.