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