public class BatchUpdateException
extends SQLException
java.lang.Object | ||||
↳ | java.lang.Throwable | |||
↳ | java.lang.Exception | |||
↳ | java.sql.SQLException | |||
↳ | java.sql.BatchUpdateException |
在批量更新操作期间发生错误时引发的子类SQLException
。 除了由SQLException
提供的信息SQLException
, BatchUpdateException
还提供了在批更新期间成功执行的所有命令的更新计数,即在错误发生之前执行的所有命令。 更新计数数组中元素的顺序与命令添加到批处理的顺序相对应。
在批量更新中的命令无法正确执行并引发BatchUpdateException
,驱动程序可能会或可能不会继续处理批处理中的其余命令。 如果驱动程序在故障发生后继续处理,则方法BatchUpdateException.getUpdateCounts
返回的数组将对批处理中的每个命令都有一个元素,而不仅仅是在错误之前成功执行的命令的元素。 在驱动程序继续处理命令的情况下,失败的任何命令的数组元素为Statement.EXECUTE_FAILED
。
Public constructors |
|
---|---|
BatchUpdateException(String reason, String SQLState, int vendorCode, int[] updateCounts) 构造一个 |
|
BatchUpdateException(String reason, String SQLState, int[] updateCounts) 构造一个 |
|
BatchUpdateException(String reason, int[] updateCounts) 构造一个使用给定的 |
|
BatchUpdateException(int[] updateCounts) 构造一个用给定的 |
|
BatchUpdateException() 构造一个 |
|
BatchUpdateException(Throwable cause) 构造一个用给定的 |
|
BatchUpdateException(int[] updateCounts, Throwable cause) 构造一个使用给定的 |
|
BatchUpdateException(String reason, int[] updateCounts, Throwable cause) 构造一个 |
|
BatchUpdateException(String reason, String SQLState, int[] updateCounts, Throwable cause) 构造一个 |
|
BatchUpdateException(String reason, String SQLState, int vendorCode, int[] updateCounts, Throwable cause) 构造一个 |
Public methods |
|
---|---|
int[] |
getUpdateCounts() 检索在发生此异常之前成功执行的批量更新中每个更新语句的更新计数。 |
Inherited methods |
|
---|---|
From class java.sql.SQLException
|
|
From class java.lang.Throwable
|
|
From class java.lang.Object
|
|
From interface java.lang.Iterable
|
BatchUpdateException (String reason, String SQLState, int vendorCode, int[] updateCounts)
构造一个BatchUpdateException
与给定的初始化的对象reason
, SQLState
, vendorCode
和updateCounts
。 cause
未初始化,并可能随后通过调用initCause(java.lang.Throwable)
方法进行初始化。
Parameters | |
---|---|
reason |
String : a description of the error |
SQLState |
String : an XOPEN or SQL:2003 code identifying the exception |
vendorCode |
int : an exception code used by a particular database vendor |
updateCounts |
int : an array of int , with each element indicating the update count, Statement.SUCCESS_NO_INFO or Statement.EXECUTE_FAILED for each SQL command in the batch for JDBC drivers that continue processing after a command failure; an update count or Statement.SUCCESS_NO_INFO for each SQL command in the batch prior to the failure for JDBC drivers that stop processing after a command failure |
BatchUpdateException (String reason, String SQLState, int[] updateCounts)
构造一个BatchUpdateException
与给定的初始化的对象reason
, SQLState
和updateCounts
。 cause
未初始化,并可能随后通过调用initCause(java.lang.Throwable)
方法进行初始化。 供应商代码初始化为0。
Parameters | |
---|---|
reason |
String : a description of the exception |
SQLState |
String : an XOPEN or SQL:2003 code identifying the exception |
updateCounts |
int : an array of int , with each element indicating the update count, Statement.SUCCESS_NO_INFO or Statement.EXECUTE_FAILED for each SQL command in the batch for JDBC drivers that continue processing after a command failure; an update count or Statement.SUCCESS_NO_INFO for each SQL command in the batch prior to the failure for JDBC drivers that stop processing after a command failure |
BatchUpdateException (String reason, int[] updateCounts)
构造一个使用给定的reason
和updateCounts
初始化的BatchUpdateException
对象。 cause
未初始化,并可能随后通过调用initCause(java.lang.Throwable)
方法进行初始化。 SQLState
初始化为null
,供应商代码初始化为0。
Parameters | |
---|---|
reason |
String : a description of the exception |
updateCounts |
int : an array of int , with each element indicating the update count, Statement.SUCCESS_NO_INFO or Statement.EXECUTE_FAILED for each SQL command in the batch for JDBC drivers that continue processing after a command failure; an update count or Statement.SUCCESS_NO_INFO for each SQL command in the batch prior to the failure for JDBC drivers that stop processing after a command failure |
BatchUpdateException (int[] updateCounts)
构造一个用给定的updateCounts
初始化的BatchUpdateException
对象。 通过调用initCause(java.lang.Throwable)
方法初始化。 reason
和SQLState
初始化为空,供应商代码初始化为0。
Parameters | |
---|---|
updateCounts |
int : an array of int , with each element indicating the update count, Statement.SUCCESS_NO_INFO or Statement.EXECUTE_FAILED for each SQL command in the batch for JDBC drivers that continue processing after a command failure; an update count or Statement.SUCCESS_NO_INFO for each SQL command in the batch prior to the failure for JDBC drivers that stop processing after a command failure |
BatchUpdateException ()
构造一个BatchUpdateException
对象。 的reason
, SQLState
和updateCounts
被初始化为null
和供应商代码被初始化为0。 cause
没有初始化,随后可以通过向一个呼叫进行初始化initCause(java.lang.Throwable)
方法。
BatchUpdateException (Throwable cause)
构造一个用给定的cause
初始化的BatchUpdateException
对象。 的SQLState
和updateCounts
被初始化为null
和供应商代码被初始化为0。 reason
被初始化为null
如果cause==null
或cause.toString()
如果cause!=null
。
Parameters | |
---|---|
cause |
Throwable : the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating the cause is non-existent or unknown. |
BatchUpdateException (int[] updateCounts, Throwable cause)
构造一个使用给定的cause
和updateCounts
初始化的BatchUpdateException
对象。 该SQLState
被初始化为null
和供应商代码被初始化为0。 reason
被初始化为null
如果cause==null
或cause.toString()
如果cause!=null
。
Parameters | |
---|---|
updateCounts |
int : an array of int , with each element indicating the update count, Statement.SUCCESS_NO_INFO or Statement.EXECUTE_FAILED for each SQL command in the batch for JDBC drivers that continue processing after a command failure; an update count or Statement.SUCCESS_NO_INFO for each SQL command in the batch prior to the failure for JDBC drivers that stop processing after a command failure |
cause |
Throwable : the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating the cause is non-existent or unknown. |
BatchUpdateException (String reason, int[] updateCounts, Throwable cause)
构造一个BatchUpdateException
与给定的初始化的对象reason
, cause
和updateCounts
。 SQLState
初始化为null
,供应商代码初始化为0。
Parameters | |
---|---|
reason |
String : a description of the exception |
updateCounts |
int : an array of int , with each element indicating the update count, Statement.SUCCESS_NO_INFO or Statement.EXECUTE_FAILED for each SQL command in the batch for JDBC drivers that continue processing after a command failure; an update count or Statement.SUCCESS_NO_INFO for each SQL command in the batch prior to the failure for JDBC drivers that stop processing after a command failure |
cause |
Throwable : the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating the cause is non-existent or unknown. |
BatchUpdateException (String reason, String SQLState, int[] updateCounts, Throwable cause)
构造一个BatchUpdateException
与给定的初始化的对象reason
, SQLState
, cause
,和updateCounts
。 供应商代码初始化为0。
Parameters | |
---|---|
reason |
String : a description of the exception |
SQLState |
String : an XOPEN or SQL:2003 code identifying the exception |
updateCounts |
int : an array of int , with each element indicating the update count, Statement.SUCCESS_NO_INFO or Statement.EXECUTE_FAILED for each SQL command in the batch for JDBC drivers that continue processing after a command failure; an update count or Statement.SUCCESS_NO_INFO for each SQL command in the batch prior to the failure for JDBC drivers that stop processing after a command failure |
cause |
Throwable : the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating the cause is non-existent or unknown. |
BatchUpdateException (String reason, String SQLState, int vendorCode, int[] updateCounts, Throwable cause)
构造一个 BatchUpdateException
与给定的初始化的对象 reason
, SQLState
, vendorCode
cause
和 updateCounts
。
Parameters | |
---|---|
reason |
String : a description of the error |
SQLState |
String : an XOPEN or SQL:2003 code identifying the exception |
vendorCode |
int : an exception code used by a particular database vendor |
updateCounts |
int : an array of int , with each element indicating the update count, Statement.SUCCESS_NO_INFO or Statement.EXECUTE_FAILED for each SQL command in the batch for JDBC drivers that continue processing after a command failure; an update count or Statement.SUCCESS_NO_INFO for each SQL command in the batch prior to the failure for JDBC drivers that stop processing after a command failure |
cause |
Throwable : the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating the cause is non-existent or unknown. |
int[] getUpdateCounts ()
检索在发生此异常之前成功执行的批量更新中每个更新语句的更新计数。 当其中一个命令执行失败时,执行批量更新的驱动程序可能会或可能不会继续处理批处理中的剩余命令。 如果驱动程序继续处理命令,则此方法返回的数组将具有与批处理中的命令一样多的元素; 否则,它将包含在BatchUpdateException
引发之前成功执行的每个命令的更新计数。
此方法的可能返回值已针对Java 2 SDK标准版1.3版进行了修改。 这是为了适应在引发BatchUpdateException
对象后继续处理批量更新命令的新选项。
Returns | |
---|---|
int[] |
an array of int containing the update counts for the updates that were executed successfully before this error occurred. Or, if the driver continues to process commands after an error, one of the following for every command in the batch:
|