Genesis2001

Untitled

Jan 9th, 2012
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.56 KB | None | 0 0
  1.  int[] java.sql.Statement.executeBatch() throws SQLException
  2.  
  3.  
  4.  
  5. executeBatch
  6. int[] executeBatch()
  7.                    throws SQLException
  8. Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts. The int elements of the array that is returned are ordered to correspond to the commands in the batch, which are ordered according to the order in which they were added to the batch. The elements in the array returned by the method executeBatch may be one of the following:
  9. A number greater than or equal to zero -- indicates that the command was processed successfully and is an update count giving the number of rows in the database that were affected by the command's execution
  10. A value of SUCCESS_NO_INFO -- indicates that the command was processed successfully but that the number of rows affected is unknown
  11. If one of the commands in a batch update fails to execute properly, this method throws a BatchUpdateException, and a JDBC driver may or may not continue to process the remaining commands in the batch. However, the driver's behavior must be consistent with a particular DBMS, either always continuing to process commands or never continuing to process commands. If the driver continues processing after a failure, the array returned by the method BatchUpdateException.getUpdateCounts will contain as many elements as there are commands in the batch, and at least one of the elements will be the following:
  12.  
  13.  
  14. A value of EXECUTE_FAILED -- indicates that the command failed to execute successfully and occurs only if a driver continues to process commands after a command fails
  15. The possible implementations and return values have been modified in the Java 2 SDK, Standard Edition, version 1.3 to accommodate the option of continuing to proccess commands in a batch update after a BatchUpdateException obejct has been thrown.
  16.  
  17.  
  18. Returns:
  19. an array of update counts containing one element for each command in the batch. The elements of the array are ordered according to the order in which commands were added to the batch.
  20. Throws:
  21. SQLException - if a database access error occurs, this method is called on a closed Statement or the driver does not support batch statements. Throws BatchUpdateException (a subclass of SQLException) if one of the commands sent to the database fails to execute properly or attempts to return a result set.
  22. Since:
  23. 1.3
  24. See Also:
  25. addBatch(java.lang.String), DatabaseMetaData.supportsBatchUpdates()
  26. --------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment