public class SQLException extends 异常 implements Iterable<Throwable>
提供有关数据库访问错误或其他错误的信息的异常。
每个SQLException提供了几种信息:
getMesasge 。 DatabaseMetaData方法getSQLStateType可用于发现驱动程序是否返回XOPEN类型或SQL:2003类型。 SQLException 。 | Constructor and Description |
|---|
SQLException()
构造一个
SQLException对象。
|
SQLException(String reason)
构造一个
SQLException对象与给定的
reason 。
|
SQLException(String reason, String SQLState)
构造一个
SQLException对象与给定的
reason和
SQLState 。
|
SQLException(String reason, String SQLState, int vendorCode)
构造一个
SQLException与给定对象
reason ,
SQLState和
vendorCode 。
|
SQLException(String reason, String sqlState, int vendorCode, Throwable cause)
构造一个
SQLException与给定对象
reason ,
SQLState ,
vendorCode和
cause 。
|
SQLException(String reason, String sqlState, Throwable cause)
构造一个
SQLException与给定对象
reason ,
SQLState和
cause 。
|
SQLException(String reason, Throwable cause)
构造一个
SQLException对象与给定的
reason和
cause 。
|
SQLException(Throwable cause)
构造一个
SQLException对象与给定的
cause 。
|
| Modifier and Type | Method and Description |
|---|---|
int |
getErrorCode()
检索此
SQLException对象的供应商特定异常代码。
|
SQLException |
getNextException()
通过setNextException(SQLException ex)检索链接到此
SQLException对象的异常。
|
String |
getSQLState()
检索此
SQLException对象的SQLState。
|
Iterator<Throwable> |
iterator()
返回链接的SQLExceptions的迭代器。
|
void |
setNextException(SQLException ex)
将
SQLException对象添加到链的末尾。
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic SQLException(String reason, String SQLState, int vendorCode)
SQLException与给定对象reason , SQLState和vendorCode 。
cause未初始化,可以随后通过调用Throwable.initCause(java.lang.Throwable)方法进行初始化 。
reason - 异常的描述
SQLState -
SQLState的XOPEN或SQL:2003代码
vendorCode - 数据库供应商特定的异常代码
public SQLException(String reason, String SQLState)
SQLException对象与给定的reason和SQLState 。
cause未初始化,可以随后通过调用Throwable.initCause(java.lang.Throwable)方法进行初始化 。
供应商代码初始化为0。
reason - 异常的描述
SQLState -
SQLState的XOPEN或SQL:2003代码
public SQLException(String reason)
SQLException对象与给定的reason 。
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)
SQLException对象与给定的cause 。
该SQLState被初始化为null ,供应商代码被初始化为0。 reason被初始化为null如果cause==null ,或cause.toString()如果cause!=null 。
cause - 这个SQLException (其保存以供getCause()方法稍后检索)的根本原因;
可能为空,表示原因不存在或未知。
public SQLException(String reason, Throwable cause)
SQLException对象与给定的reason和cause 。
SQLState初始化为null ,供应商代码初始化为0。
reason - 异常的描述。
cause -底层原因SQLException (保存用于由稍后检索getCause()方法);
可能为空,表示原因不存在或未知。
public SQLException(String reason, String sqlState, Throwable cause)
SQLException与给定对象reason , SQLState和cause 。
供应商代码初始化为0。
reason - 异常的描述。
sqlState -
sqlState的XOPEN或SQL:2003代码
cause - SQLException (其保存以供getCause()方法稍后检索)的根本原因;
可能为空,表示原因不存在或未知。
public SQLException(String reason, String sqlState, int vendorCode, Throwable cause)
SQLException与给定对象
reason ,
SQLState ,
vendorCode和
cause 。
reason - 异常的描述
sqlState -
sqlState的XOPEN或SQL:2003代码
vendorCode - 数据库供应商特定的异常代码
cause - 这个SQLException (其保存以供getCause()方法稍后检索)的根本原因;
可能为空,表示原因不存在或未知。
public String getSQLState()
SQLException对象的SQLState。
public int getErrorCode()
SQLException对象的供应商特定异常代码。
public SQLException getNextException()
SQLException对象的异常。
SQLException对象;
null如果没有
setNextException(java.sql.SQLException)
public void setNextException(SQLException ex)
SQLException对象添加到链的末尾。
ex - 将添加到
SQLException链结尾的新
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.