FileDocCategorySizeDatePackage
BatchUpdateException.javaAPI DocAndroid 1.5 API7013Wed May 06 22:41:06 BST 2009java.sql

BatchUpdateException

public class BatchUpdateException extends SQLException implements Serializable
This 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}.

since
Android 1.0

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.

since
Android 1.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.

param
updateCounts the array of {@code updateCounts} giving the number of successful updates (or another status code) for each command in the batch that was attempted.
since
Android 1.0

        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.

param
reason the message providing information about the source of this exception.
param
updateCounts the array of {@code updateCounts} giving the number of successful updates (or another status code) for each command in the batch that was attempted.
since
Android 1.0

        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.

param
reason the message providing information about the source of this exception.
param
SQLState the X/OPEN value to use for the {@code SQLState}
param
updateCounts the array of {@code updateCounts} giving the number of successful updates (or another status code) for each command in the batch that was attempted.
since
Android 1.0

        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.

param
reason the message providing information about the source of this exception.
param
SQLState the X/OPEN value to use for the {@code SQLState}.
param
vendorCode the value to use for the vendor error code.
param
updateCounts the array of {@code updateCounts} giving the number of successful updates (or another status code) for each command in the batch that was attempted.
since
Android 1.0

        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
an array that contains the successful update counts, before this exception was thrown. Alternatively, if the driver continues to process commands following an error, for each successive command there is a corresponding element in the array giving one of the following status values:
  1. the number of successful updates
  2. {@code Statement.SUCCESS_NO_INFO} indicating that the command completed successfully, but the amount of altered rows is unknown.
  3. {@code Statement.EXECUTE_FAILED} indicating that the command was unsuccessful.
since
Android 1.0

        return updateCounts;