java - mysql jdbc connector batch update exception update count not as expected -


i using batch insert java application mysql database bulk data loading. compiling result of failed executions, handling batchupdateexception in following way:

  catch (batchupdateexception e)         {             int[] codes = e.getupdatecounts();               (int = 0; i<codes.length; i++)             {                 if (statement.execute_failed == codes[i])                 {                     lr.recordloadcount--;                      //`records` list containing objects                      //added in batch                      lr.addfailreason(records.get(i).xmlstring());                   }             }              lr.addexception(e.getmessage());          }  

i running case executions fail (table not exist). ideally having fail reason added every record.

however, find first record, being added. when debugged code, found codes[0] coming '-1', whereas other coming '-3' (which statement.execute_failed).

as per javadocs:

 public int[] getupdatecounts()  returns: array of int containing update counts updates executed before error occurred.   or, if driver continues process commands after error, 1 of  following every command in batch:   - update count  - statement.success_no_info ('-2')  - statement.execute_failed ('-3')  

question: mysql connector/j not set update count correctly first execution failure in batch, or missing here? has come across such scenario?

i using connector/j 5.1.30; mysql 5.5.24 on ubuntu 12.04

i found problem "rewritebatchedstatements=true" connection option. when option being used, reported issue happens. report bug.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -