public class BatchUpdateException extends SQLException implements Serializable
A BatchUpdateException provides additional information about the
problem that occurred, compared with a standard SQLException. It
supplies update counts for successful commands which were executed before the
exception was encountered.
The element order in the array of update counts matches the order that the commands were added to the batch operation.
Once a batch update command fails and a BatchUpdateException is
thrown, the JDBC driver may continue processing the remaining commands in the
batch. If the driver does process more commands after the problem occurs, the
array returned by BatchUpdateException.getUpdateCounts has an element
for every command in the batch, not only those that executed successfully. In
this case, the array element for any command which encountered a problem is
set to Statement.EXECUTE_FAILED.
| Constructor and Description |
|---|
BatchUpdateException()
Creates a default
BatchUpdateException with the parameters
reason, SQLState, and update counts set to null and the vendor code set to 0. |
BatchUpdateException(int[] updateCounts)
Creates a
BatchUpdateException with the updateCounts set
to the supplied value. |
BatchUpdateException(int[] updateCounts,
Throwable cause)
Creates an BatchUpdateException object.
|
BatchUpdateException(String reason,
int[] updateCounts)
Creates a
BatchUpdateException with the updateCounts and
reason set to the supplied values. |
BatchUpdateException(String reason,
int[] updateCounts,
Throwable cause)
Creates an BatchUpdateException object.
|
BatchUpdateException(String reason,
String SQLState,
int[] updateCounts)
Creates a
BatchUpdateException with the reason, SQLState and updateCounts set to the supplied values. |
BatchUpdateException(String reason,
String SQLState,
int[] updateCounts,
Throwable cause)
Creates an BatchUpdateException object.
|
BatchUpdateException(String reason,
String SQLState,
int vendorCode,
int[] updateCounts)
Creates a
BatchUpdateException for the case where all relevant
information is provided. |
BatchUpdateException(String reason,
String SQLState,
int vendorCode,
int[] updateCounts,
Throwable cause)
Creates an BatchUpdateException object.
|
BatchUpdateException(Throwable cause)
Creates an BatchUpdateException object.
|
| Modifier and Type | Method and Description |
|---|---|
int[] |
getUpdateCounts()
Gets the update count array giving status information for every
command that was attempted in the batch.
|
getErrorCode, getNextException, getSQLState, iterator, setNextExceptionaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic BatchUpdateException()
BatchUpdateException with the parameters
reason, SQLState, and update counts set to null and the vendor code set to 0.public BatchUpdateException(Throwable cause)
cause - the Throwable object for the underlying reason this SQLExceptionpublic BatchUpdateException(int[] updateCounts,
Throwable cause)
cause - the Throwable object for the underlying reason this SQLExceptionpublic BatchUpdateException(String reason, int[] updateCounts, Throwable cause)
cause - the Throwable object for the underlying reason this SQLExceptionpublic BatchUpdateException(String reason, String SQLState, int[] updateCounts, Throwable cause)
cause - the Throwable object for the underlying reason this SQLExceptionpublic BatchUpdateException(String reason, String SQLState, int vendorCode, int[] updateCounts, Throwable cause)
cause - the Throwable object for the underlying reason this SQLExceptionpublic BatchUpdateException(int[] updateCounts)
BatchUpdateException with the updateCounts set
to the supplied value. All other fields are set to their
default values.updateCounts - the array of updateCounts giving the number of
successful updates (or another status code) for each command
in the batch that was attempted.public BatchUpdateException(String reason, int[] updateCounts)
BatchUpdateException with the updateCounts and
reason set to the supplied values. All other fields are set to their
default values.reason - the message providing information about the source of this
exception.updateCounts - the array of updateCounts giving the number of
successful updates (or another status code) for each command
in the batch that was attempted.public BatchUpdateException(String reason, String SQLState, int[] updateCounts)
BatchUpdateException with the reason, SQLState and updateCounts set to the supplied values. All other
fields are set to their default values.reason - the message providing information about the source of this
exception.SQLState - the X/OPEN value to use for the SQLStateupdateCounts - the array of updateCounts giving the number of
successful updates (or another status code) for each command
in the batch that was attempted.public BatchUpdateException(String reason, String SQLState, int vendorCode, int[] updateCounts)
BatchUpdateException for the case where all relevant
information is provided.reason - the message providing information about the source of this
exception.SQLState - the X/OPEN value to use for the SQLState.vendorCode - the value to use for the vendor error code.updateCounts - the array of updateCounts giving the number of
successful updates (or another status code) for each command
in the batch that was attempted.public int[] getUpdateCounts()
If a batch update command fails and a BatchUpdateException is
thrown, the JDBC driver may continue processing the remaining commands in
the batch. If the driver does so, the array returned by BatchUpdateException.getUpdateCounts has an element for every command in
the batch, not only those that executed successfully. In this case, the
array element for any command which encountered a problem is set to
Statement.EXECUTE_FAILED.
Statement.SUCCESS_NO_INFO indicating that the command completed
successfully, but the amount of altered rows is unknown.Statement.EXECUTE_FAILED indicating that the command
was unsuccessful.