Most visited

Recently visited

Added in API level 1

BatchUpdateException

public class BatchUpdateException
extends SQLException

java.lang.Object
   ↳ java.lang.Throwable
     ↳ java.lang.Exception
       ↳ java.sql.SQLException
         ↳ java.sql.BatchUpdateException


在批量更新操作期间发生错误时引发的子类SQLException 除了由SQLException提供的信息SQLExceptionBatchUpdateException还提供了在批更新期间成功执行的所有命令的更新计数,即在错误发生之前执行的所有命令。 更新计数数组中元素的顺序与命令添加到批处理的顺序相对应。

在批量更新中的命令无法正确执行并引发BatchUpdateException ,驱动程序可能会或可能不会继续处理批处理中的其余命令。 如果驱动程序在故障发生后继续处理,则方法BatchUpdateException.getUpdateCounts返回的数组将对批处理中的每个命令都有一个元素,而不仅仅是在错误之前成功执行的命令的元素。 在驱动程序继续处理命令的情况下,失败的任何命令的数组元素为Statement.EXECUTE_FAILED

Summary

Public constructors

BatchUpdateException(String reason, String SQLState, int vendorCode, int[] updateCounts)

构造一个 BatchUpdateException与给定的初始化的对象 reasonSQLStatevendorCodeupdateCounts

BatchUpdateException(String reason, String SQLState, int[] updateCounts)

构造一个 BatchUpdateException与给定的初始化的对象 reasonSQLStateupdateCounts

BatchUpdateException(String reason, int[] updateCounts)

构造一个使用给定的 reasonupdateCounts初始化的 BatchUpdateException对象。

BatchUpdateException(int[] updateCounts)

构造一个用给定的 updateCounts初始化的 BatchUpdateException对象。

BatchUpdateException()

构造一个 BatchUpdateException对象。

BatchUpdateException(Throwable cause)

构造一个用给定的 cause初始化的 BatchUpdateException对象。

BatchUpdateException(int[] updateCounts, Throwable cause)

构造一个使用给定的 causeupdateCounts初始化的 BatchUpdateException对象。

BatchUpdateException(String reason, int[] updateCounts, Throwable cause)

构造一个 BatchUpdateException与给定的初始化的对象 reasoncauseupdateCounts

BatchUpdateException(String reason, String SQLState, int[] updateCounts, Throwable cause)

构造一个 BatchUpdateException与给定的初始化的对象 reasonSQLStatecause ,和 updateCounts

BatchUpdateException(String reason, String SQLState, int vendorCode, int[] updateCounts, Throwable cause)

构造一个 BatchUpdateException与给定的初始化的对象 reasonSQLStatevendorCode causeupdateCounts

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

Public constructors

BatchUpdateException

Added in API level 1
BatchUpdateException (String reason, 
                String SQLState, 
                int vendorCode, 
                int[] updateCounts)

构造一个BatchUpdateException与给定的初始化的对象reasonSQLStatevendorCodeupdateCounts 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

Added in API level 1
BatchUpdateException (String reason, 
                String SQLState, 
                int[] updateCounts)

构造一个BatchUpdateException与给定的初始化的对象reasonSQLStateupdateCounts 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

Added in API level 1
BatchUpdateException (String reason, 
                int[] updateCounts)

构造一个使用给定的reasonupdateCounts初始化的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

Added in API level 1
BatchUpdateException (int[] updateCounts)

构造一个用给定的updateCounts初始化的BatchUpdateException对象。 通过调用initCause(java.lang.Throwable)方法初始化。 reasonSQLState初始化为空,供应商代码初始化为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

Added in API level 1
BatchUpdateException ()

构造一个BatchUpdateException对象。 reasonSQLStateupdateCounts被初始化为null和供应商代码被初始化为0。 cause没有初始化,随后可以通过向一个呼叫进行初始化initCause(java.lang.Throwable)方法。

BatchUpdateException

Added in API level 9
BatchUpdateException (Throwable cause)

构造一个用给定的cause初始化的BatchUpdateException对象。 SQLStateupdateCounts被初始化为null和供应商代码被初始化为0。 reason被初始化为null如果cause==nullcause.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

Added in API level 9
BatchUpdateException (int[] updateCounts, 
                Throwable cause)

构造一个使用给定的causeupdateCounts初始化的BatchUpdateException对象。 SQLState被初始化为null和供应商代码被初始化为0。 reason被初始化为null如果cause==nullcause.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

Added in API level 9
BatchUpdateException (String reason, 
                int[] updateCounts, 
                Throwable cause)

构造一个BatchUpdateException与给定的初始化的对象reasoncauseupdateCounts 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

Added in API level 9
BatchUpdateException (String reason, 
                String SQLState, 
                int[] updateCounts, 
                Throwable cause)

构造一个BatchUpdateException与给定的初始化的对象reasonSQLStatecause ,和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

Added in API level 9
BatchUpdateException (String reason, 
                String SQLState, 
                int vendorCode, 
                int[] updateCounts, 
                Throwable cause)

构造一个 BatchUpdateException与给定的初始化的对象 reasonSQLStatevendorCode causeupdateCounts

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.

Public methods

getUpdateCounts

Added in API level 1
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:
  1. an update count
  2. Statement.SUCCESS_NO_INFO to indicate that the command executed successfully but the number of rows affected is unknown
  3. Statement.EXECUTE_FAILED to indicate that the command failed to execute successfully

Hooray!