BatchUpdateExceptionpublic class BatchUpdateException extends SQLException implements SerializableThis exception is thrown if a problem occurs during a batch update operation.
A {@code BatchUpdateException} provides additional information about the
problem that occurred, compared with a standard {@code 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 {@code 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 {@code 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 {@code Statement.EXECUTE_FAILED}.
|
Fields Summary |
---|
private static final long | serialVersionUID | private int[] | updateCounts |
Constructors Summary |
---|
public BatchUpdateException()Creates a default {@code BatchUpdateException} with the parameters
reason, SQLState, and update counts set to {@code
null} and the vendor code set to 0.
super();
| public BatchUpdateException(int[] updateCounts)Creates a {@code BatchUpdateException} with the {@code updateCounts} set
to the supplied value. All other fields are set to their
default values.
super();
this.updateCounts = updateCounts;
| public BatchUpdateException(String reason, int[] updateCounts)Creates a {@code BatchUpdateException} with the {@code updateCounts} and
{@code reason} set to the supplied values. All other fields are set to their
default values.
super(reason);
this.updateCounts = updateCounts;
| public BatchUpdateException(String reason, String SQLState, int[] updateCounts)Creates a {@code BatchUpdateException} with the {@code reason}, {@code
SQLState} and {@code updateCounts} set to the supplied values. All other
fields are set to their default values.
super(reason, SQLState);
this.updateCounts = updateCounts;
| public BatchUpdateException(String reason, String SQLState, int vendorCode, int[] updateCounts)Creates a {@code BatchUpdateException} for the case where all relevant
information is provided.
super(reason, SQLState, vendorCode);
this.updateCounts = updateCounts;
|
Methods Summary |
---|
public int[] | getUpdateCounts()Gets the update count array giving status information for every
command that was attempted in the batch.
If a batch update command fails and a {@code BatchUpdateException} is
thrown, the JDBC driver may continue processing the remaining commands in
the batch. If the driver does so, the array returned by {@code
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
{@code Statement.EXECUTE_FAILED}.
return updateCounts;
|
|