这样的做法不是很好,据JDK所描述的,使用Batch执行SQL的话可能是遇到出错时,跳过该执行语句,继续下一个SQL语句的执行,所以不要用Batch,不过效率也会差一些
解决方案 »
- 帮忙写个url rewriter正则
- 怎么用多线程实现进度条同步上传
- Logger appear to be Log
- jsp连接数据库access时遇到的问题!【新手求救】
- 想在网站上添加收发短信的功能?请详细讲一下步骤(越详细越好!!)
- 好奇怪!高手看一下
- tomcat4.1.27安装后无法启动,报错如下
- 如何在Servlet中向一个模态的浏览器窗口写入数据?求救!
- 关于pageContext.getServletContext()的错误,(急,在线等,分不够可再加)
- web.xml的问题(谢谢)
- [请教]ArrayList中放了HashMap对象,但取出来的时候都是null,谢谢
- 请问:Tomcat下载??
throws SQLExceptionSubmits 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:
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 A value of SUCCESS_NO_INFO -- indicates that the command was processed successfully but that the number of rows affected is unknown 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:
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
A driver is not required to implement this method. 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.