|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjava.lang.Throwable
java.lang.Exception
java.sql.SQLException
public class SQLException
提供關於資料庫存取錯誤或其他錯誤資訊的異常。
每個 SQLException 都可提供以下多種訊息:
getMessage 獲得。
DatabaseMetaData 的方法 getSQLStateType 可用於確定驅動程序返回 XOPEN 型別還是 SQL:2003 型別。
SQLException 的原因。
| 建構子摘要 | |
|---|---|
SQLException()
建構一個 SQLException 物件。 |
|
SQLException(String reason)
建構一個具有給定 reason 的 SQLException 物件。 |
|
SQLException(String reason,
String SQLState)
建構一個具有給定 reason 和 SQLState 的 SQLException 物件。 |
|
SQLException(String reason,
String SQLState,
int vendorCode)
建構一個具有給定 reason、SQLState 和 vendorCode 的 SQLException 物件。 |
|
SQLException(String reason,
String sqlState,
int vendorCode,
Throwable cause)
建構一個具有給定 reason、SQLState、vendorCode 和 cause 的 SQLException 物件。 |
|
SQLException(String reason,
String sqlState,
Throwable cause)
建構一個具有給定 reason、SQLState 和 cause 的 SQLException 物件。 |
|
SQLException(String reason,
Throwable cause)
建構一個具有給定 reason 和 cause 的 SQLException 物件。 |
|
SQLException(Throwable cause)
建構一個具有給定 cause 的 SQLException 物件。 |
|
| 方法摘要 | |
|---|---|
int |
getErrorCode()
獲取此 SQLException 物件的特定於供應商的異常程式碼。 |
SQLException |
getNextException()
通過 setNextException(SQLException ex) 獲取連接到此 SQLException 物件的異常。 |
String |
getSQLState()
獲取此 SQLException 物件的 SQLState。 |
Iterator<Throwable> |
iterator()
返回在連接的 SQLExceptions 上進行迭代的迭代器。 |
void |
setNextException(SQLException ex)
將 SQLException 物件添加到連接的末尾。 |
| 從類別 java.lang.Throwable 繼承的方法 |
|---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 建構子詳細資訊 |
|---|
public SQLException(String reason,
String SQLState,
int vendorCode)
reason、SQLState 和 vendorCode 的 SQLException 物件。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。如果 cause==null,則 reason 被初始化為 null;如果 cause!=null,則初始化為 cause.toString()。
cause - 導致此 SQLException 的底層原因(保存此 cause,以供以後通過 getCause() 方法獲取);此參數可以為 null,指示 cause 不存在或未知。
public SQLException(String reason,
Throwable cause)
reason 和 cause 的 SQLException 物件。SQLState 被初始化為 null,供應商程式碼被初始化為 0。
reason - 對異常的描述。cause - 導致此 SQLException 的底層原因(保存此 cause,以供以後通過 getCause() 方法獲取);此參數可以為 null,指示 cause 不存在或未知。
public SQLException(String reason,
String sqlState,
Throwable cause)
reason、SQLState 和 cause 的 SQLException 物件。供應商程式碼被初始化為 0。
reason - 對異常的描述。sqlState - 標識異常的 XOPEN 或 SQL:2003 程式碼cause - 導致此 SQLException 的底層原因(保存此 cause,以供以後通過 getCause() 方法獲取);此參數可以為 null,指示 cause 不存在或未知。
public SQLException(String reason,
String sqlState,
int vendorCode,
Throwable cause)
reason、SQLState、vendorCode 和 cause 的 SQLException 物件。
reason - 對異常的描述sqlState - 標識異常的 XOPEN 或 SQL:2003 程式碼vendorCode - 特定於資料庫供應商的異常程式碼cause - 導致此 SQLException 的底層原因(保存此 cause,以供以後通過 getCause() 方法獲取);此參數可以為 null,指示 cause 不存在或未知。| 方法詳細資訊 |
|---|
public String getSQLState()
SQLException 物件的 SQLState。
public int getErrorCode()
SQLException 物件的特定於供應商的異常程式碼。
public SQLException getNextException()
SQLException 物件的異常。
SQLException 物件;如果不存在,則返回 nullsetNextException(java.sql.SQLException)public void setNextException(SQLException ex)
SQLException 物件添加到連接的末尾。
ex - 將添加到 SQLException 連接末尾的新異常getNextException()public Iterator<Throwable> iterator()
Iterable<Throwable> 中的 iterator
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。