JavaTM 2 Platform
Standard Ed. 6

java.sql
類別 SQLIntegrityConstraintViolationException

java.lang.Object
  繼承者 java.lang.Throwable
      繼承者 java.lang.Exception
          繼承者 java.sql.SQLException
              繼承者 java.sql.SQLNonTransientException
                  繼承者 java.sql.SQLIntegrityConstraintViolationException
所有已實作的介面:
Serializable, Iterable<Throwable>

public class SQLIntegrityConstraintViolationException
extends SQLNonTransientException

當 SQLState 類別值為“23”時拋出的 SQLException 子類別。此異常表示違反了一個完整性約束(外鍵、主鍵或唯一鍵)。

從以下版本開始:
1.6
另請參見:
序列化表格

建構子摘要
SQLIntegrityConstraintViolationException()
          建構一個 SQLIntegrityConstraintViolationException 物件。
SQLIntegrityConstraintViolationException(String reason)
          建構一個帶有給定 reasonSQLIntegrityConstraintViolationException
SQLIntegrityConstraintViolationException(String reason, String SQLState)
          建構一個帶有給定 reasonSQLStateSQLIntegrityConstraintViolationException 物件。
SQLIntegrityConstraintViolationException(String reason, String SQLState, int vendorCode)
          建構一個帶有給定 reasonSQLStatevendorCodeSQLIntegrityConstraintViolationException 物件。
SQLIntegrityConstraintViolationException(String reason, String SQLState, int vendorCode, Throwable cause)
          建構一個帶有給定 reasonSQLStatevendorCodecauseSQLIntegrityConstraintViolationException 物件。
SQLIntegrityConstraintViolationException(String reason, String SQLState, Throwable cause)
          建構一個帶有給定 reasonSQLStatecauseSQLIntegrityConstraintViolationException 物件。
SQLIntegrityConstraintViolationException(String reason, Throwable cause)
          建構一個帶有給定 reasoncauseSQLIntegrityConstraintViolationException 物件。
SQLIntegrityConstraintViolationException(Throwable cause)
          建構一個帶有給定 causeSQLIntegrityConstraintViolationException 物件。
 
方法摘要
 
從類別 java.sql.SQLException 繼承的方法
getErrorCode, getNextException, getSQLState, iterator, setNextException
 
從類別 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
 

建構子詳細資訊

SQLIntegrityConstraintViolationException

public SQLIntegrityConstraintViolationException()
建構一個 SQLIntegrityConstraintViolationException 物件。reasonSQLState 初始化為 null,供應商程式碼初始化為 0。 cause 沒有初始化,隨後可以調用 Throwable.initCause(java.lang.Throwable) 方法初始化。

從以下版本開始:
1.6

SQLIntegrityConstraintViolationException

public SQLIntegrityConstraintViolationException(String reason)
建構一個帶有給定 reasonSQLIntegrityConstraintViolationExceptionSQLState 初始化為 null,供應商程式碼初始化為 0。 cause 沒有初始化,隨後可以調用 Throwable.initCause(java.lang.Throwable) 方法初始化。

參數:
reason - 對異常的描述
從以下版本開始:
1.6

SQLIntegrityConstraintViolationException

public SQLIntegrityConstraintViolationException(String reason,
                                                String SQLState)
建構一個帶有給定 reasonSQLStateSQLIntegrityConstraintViolationException 物件。 cause 沒有初始化,隨後可以調用 Throwable.initCause(java.lang.Throwable) 方法初始化。供應商程式碼初始化為 0。

參數:
reason - 對異常的描述
SQLState - 標識異常的 XOPEN 或 SQL:2003 程式碼
從以下版本開始:
1.6

SQLIntegrityConstraintViolationException

public SQLIntegrityConstraintViolationException(String reason,
                                                String SQLState,
                                                int vendorCode)
建構一個帶有給定 reasonSQLStatevendorCodeSQLIntegrityConstraintViolationException 物件。 cause 沒有初始化,隨後可以調用 Throwable.initCause(java.lang.Throwable) 方法初始化。

參數:
reason - 對異常的描述
SQLState - 標識異常的 XOPEN 或 SQL:2003 程式碼
vendorCode - 特定於資料庫供應商的異常程式碼
從以下版本開始:
1.6

SQLIntegrityConstraintViolationException

public SQLIntegrityConstraintViolationException(Throwable cause)
建構一個帶有給定 causeSQLIntegrityConstraintViolationException 物件。SQLState 初始化為 null,供應商程式碼初始化為 0。如果 cause==null,那麼 reason 初始化為 null;如果 cause!=null,則初始化為 cause.toString()

參數:
cause - 此 SQLException 的底層原因(保存此原因,以供以後通過 getCause() 方法獲取);可以為 null,表示 cause 不存在或未知。
從以下版本開始:
1.6

SQLIntegrityConstraintViolationException

public SQLIntegrityConstraintViolationException(String reason,
                                                Throwable cause)
建構一個帶有給定 reasoncauseSQLIntegrityConstraintViolationException 物件。SQLState 初始化為 null,供應商程式碼初始化為 0。

參數:
reason - 對異常的描述。
cause - 原因(保存此原因,以供以後通過 getCause() 方法獲取);可以為 null,表示 cause 不存在或未知。
從以下版本開始:
1.6

SQLIntegrityConstraintViolationException

public SQLIntegrityConstraintViolationException(String reason,
                                                String SQLState,
                                                Throwable cause)
建構一個帶有給定 reasonSQLStatecauseSQLIntegrityConstraintViolationException 物件。供應商程式碼初始化為 0。

參數:
reason - 對異常的描述。
SQLState - 標識異常的 XOPEN 或 SQL:2003 程式碼
cause - 此 SQLException 的底層原因(保存此原因,以供以後通過 getCause() 方法獲取);可以為 null,表示 cause 不存在或未知。
從以下版本開始:
1.6

SQLIntegrityConstraintViolationException

public SQLIntegrityConstraintViolationException(String reason,
                                                String SQLState,
                                                int vendorCode,
                                                Throwable cause)
建構一個帶有給定 reasonSQLStatevendorCodecauseSQLIntegrityConstraintViolationException 物件。

參數:
reason - 對異常的描述
SQLState - 標識異常的 XOPEN 或 SQL:2003 程式碼
vendorCode - 特定於資料庫供應商的異常程式碼
cause - 原因(保存此原因,以供以後通過 getCause() 方法獲取);可以為 null,表示 cause 不存在或未知。
從以下版本開始:
1.6

JavaTM 2 Platform
Standard Ed. 6

提交錯誤或意見

版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only