public class SQLException extends 异常 implements Iterable<Throwable>
在数据库访问错误或其他错误中提供信息的异常。
每个SQLException
提供多种类型的信息:
getMesasge
。getSQLStateType
DatabaseMetaData
方法可以用来发现司机是否返回XOPEN型或SQL描述:2003型。SQLException
。Constructor and Description |
---|
SQLException()
构建了一个
SQLException 对象。
|
SQLException(String reason)
构建一个与给定的
reason
SQLException 对象。
|
SQLException(String reason, String SQLState)
构建一个与给定的
reason 和
SQLState
SQLException 对象。
|
SQLException(String reason, String SQLState, int vendorCode)
构建了一个
SQLException 对象与一个给定的
reason ,
SQLState 和
vendorCode 。
|
SQLException(String reason, String sqlState, int vendorCode, Throwable cause)
构建一个与给定的
reason ,
SQLState
SQLException 对象,
vendorCode 和
cause 。
|
SQLException(String reason, String sqlState, Throwable cause)
构建了一个
SQLException 对象与一个给定的
reason ,
SQLState 和
cause 。
|
SQLException(String reason, Throwable cause)
构建一个与给定的
reason 和
cause
SQLException 对象。
|
SQLException(Throwable cause)
构建一个与给定的
cause
SQLException 对象。
|
Modifier and Type | Method and Description |
---|---|
int |
getErrorCode()
检索此
SQLException 对象的特定于供应商的异常代码。
|
SQLException |
getNextException()
检索异常锁这
SQLException 对象setnextexception(不前)。
|
String |
getSQLState()
检索此
SQLException 对象SQLSTATE。
|
Iterator<Throwable> |
iterator()
返回在链式sqlexception迭代器。
|
void |
setNextException(SQLException ex)
SQLException 对象添加到链的末尾。
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public SQLException(String reason, String SQLState, int vendorCode)
SQLException
对象与一个给定的
reason
,
SQLState
和
vendorCode
。的
cause
没有初始化,并随后可被调用的方法的
Throwable.initCause(java.lang.Throwable)
初始化。
reason
-描述的例外
SQLState
- XOPEN或SQL:2003码识别异常
vendorCode
-数据库供应商特定的异常代码
public SQLException(String reason, String SQLState)
reason
和
SQLState
SQLException
对象。的
cause
没有初始化,并随后可被调用的方法的
Throwable.initCause(java.lang.Throwable)
初始化。供应商代码被初始化为0。
reason
-描述的例外
SQLState
- XOPEN或SQL:2003码识别异常
public SQLException(String reason)
reason
SQLException
对象。的
SQLState
初始化为
null
和厂商代码初始化为0。的
cause
没有初始化,并随后可被调用的方法的
Throwable.initCause(java.lang.Throwable)
初始化。
reason
-描述的例外
public SQLException()
SQLException
对象。的
reason
,
SQLState
初始化为
null
和厂商代码初始化为0。的
cause
没有初始化,并随后可被调用的方法的
Throwable.initCause(java.lang.Throwable)
初始化。
public SQLException(Throwable cause)
cause
SQLException
对象,
SQLState
初始化为
null
和厂商代码初始化为0。的
reason
初始化为
null
如果
cause==null
或
cause.toString()
如果
cause!=null
。
cause
-这
SQLException
的根本原因(这是以后的
getCause()
方法检索);可能是null指示的原因是不存在的或未知的。
public SQLException(String reason, Throwable cause)
reason
和
cause
SQLException
对象,
SQLState
初始化为
null
和厂商代码初始化为0。
reason
-描述的例外。
cause
-这
SQLException
的根本原因(这是以后的
getCause()
方法检索);可能是null指示的原因是不存在的或未知的。
public SQLException(String reason, String sqlState, Throwable cause)
SQLException
对象与一个给定的
reason
,
SQLState
和
cause
。供应商代码初始化为0。
reason
-描述的例外。
sqlState
- XOPEN或SQL:2003码识别异常
cause
-这
SQLException
的根本原因(这是以后的
getCause()
方法检索);可能是null指示的原因是不存在的或未知的。
public SQLException(String reason, String sqlState, int vendorCode, Throwable cause)
reason
,
SQLState
SQLException
对象,
vendorCode
和
cause
。
reason
-描述的例外
sqlState
- XOPEN或SQL:2003码识别异常
vendorCode
-数据库供应商特定的异常代码
cause
-这
SQLException
的根本原因(这是以后的
getCause()
方法检索);可能是null指示的原因是不存在的或未知的。
public String getSQLState()
SQLException
对象SQLSTATE。
public int getErrorCode()
SQLException
对象的特定于供应商的异常代码。
public SQLException getNextException()
SQLException
对象setnextexception(不前)。
SQLException
对象;如果没有
null
setNextException(java.sql.SQLException)
public void setNextException(SQLException ex)
SQLException
对象添加到链的末尾。
ex
-新的异常将被添加到该
SQLException
链末端
getNextException()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.