List of usage examples for java.sql BatchUpdateException getUpdateCounts
public int[] getUpdateCounts()
From source file:org.openmrs.util.databasechange.ConceptValidatorChangeSet.java
/** * Executes all the changes to the concept names as a batch update. * * @param connection The database connection *//*from ww w .jav a 2s .c om*/ private void runBatchUpdate(JdbcConnection connection) { PreparedStatement pStmt = null; try { connection.setAutoCommit(false); pStmt = connection.prepareStatement( "UPDATE concept_name SET locale = ?, concept_name_type = ?, locale_preferred = ?, voided = ?, date_voided = ?, void_reason = ?, voided_by = ? WHERE concept_name_id = ?"); Integer userId = DatabaseUpdater.getAuthenticatedUserId(); //is we have no authenticated user(for API users), set as Daemon if (userId == null || userId < 1) { userId = getInt(connection, "SELECT min(user_id) FROM users"); //leave it as null rather than setting it to 0 if (userId < 1) { userId = null; } } for (ConceptName conceptName : updatedConceptNames) { pStmt.setString(1, conceptName.getLocale().toString()); pStmt.setString(2, (conceptName.getConceptNameType() != null) ? conceptName.getConceptNameType().toString() : null); pStmt.setBoolean(3, conceptName.isLocalePreferred()); pStmt.setBoolean(4, conceptName.isVoided()); pStmt.setDate(5, conceptName.isVoided() ? new Date(System.currentTimeMillis()) : null); pStmt.setString(6, conceptName.getVoidReason()); // "Not all databases allow for a non-typed Null to be sent to the backend", so we can't use setInt pStmt.setObject(7, (conceptName.isVoided() && userId != null) ? userId : null, Types.INTEGER); pStmt.setInt(8, conceptName.getConceptNameId()); pStmt.addBatch(); } try { int[] updateCounts = pStmt.executeBatch(); for (int i = 0; i < updateCounts.length; i++) { if (updateCounts[i] > -1) { log.debug("Successfully executed: updateCount=" + updateCounts[i]); } else if (updateCounts[i] == Statement.SUCCESS_NO_INFO) { log.debug("Successfully executed; No Success info"); } else if (updateCounts[i] == Statement.EXECUTE_FAILED) { log.warn("Failed to execute update"); } } log.debug("Committing updates..."); connection.commit(); } catch (BatchUpdateException be) { log.warn("Error generated while processsing batch update", be); int[] updateCounts = be.getUpdateCounts(); for (int i = 0; i < updateCounts.length; i++) { if (updateCounts[i] > -1) { log.warn("Executed with exception: updateCount=" + updateCounts[i]); } else if (updateCounts[i] == Statement.SUCCESS_NO_INFO) { log.warn("Executed with exception; No Success info"); } else if (updateCounts[i] == Statement.EXECUTE_FAILED) { log.warn("Failed to execute update with exception"); } } try { log.warn("Rolling back batch", be); connection.rollback(); } catch (Exception rbe) { log.warn("Error generated while rolling back batch update", be); } } } catch (SQLException e) { log.warn("Error generated", e); } catch (DatabaseException e) { log.warn("Error generated", e); } finally { //reset to auto commit mode try { connection.setAutoCommit(true); } catch (DatabaseException e) { log.warn("Failed to reset auto commit back to true", e); } if (pStmt != null) { try { pStmt.close(); } catch (SQLException e) { log.warn("Failed to close the prepared statement object"); } } } }
From source file:org.rimudb.Session.java
public void commit(boolean ignoreErrors) throws RimuDBException { try {//w ww. ja va 2 s. co m if (getCurrentBatchSize() > 0) { // Execute all the batches in the queue while (statementQueue.size() > 0) { BatchEntry batchEntry = statementQueue.remove(); PreparedStatement ps = batchEntry.getPreparedStatement(); try { int[] results = ps.executeBatch(); } catch (BatchUpdateException be) { // Iterate through the batch counts to determine which data object had the error int[] updateCounts = be.getUpdateCounts(); // If the updateCounts match the number of records in the batch, then if (updateCounts.length == batchEntry.getSize()) { // Log a warning message with the entries that failed. for (int i = 0; i < updateCounts.length; i++) { if (updateCounts[i] == Statement.EXECUTE_FAILED) { DataObject dataObject = batchEntry.getDataObject(i); log.warn("Batch update of " + dataObject.getClass().getSimpleName() + " " + dataObject.getPrimaryWhereList() + " failed."); } } } if (!ignoreErrors) { throw be; } } // If this was a batch insert with generated keys if (batchEntry.getType() == BATCH_INSERT) { // If this table has generated keys and the database supports them then if (batchEntry.getTable().processesGeneratedKeys()) { // Populate the record Record[] records = batchEntry.getRecords(); batchEntry.getTable().populateGeneratedKeys(ps, records); } } ps.close(); } } // Commit the transaction getConnection().commit(); } catch (SQLException e) { throw new RimuDBException(e, getClass().getName()); } }
From source file:org.wso2.andes.store.rdbms.RDBMSStoreUtils.java
/** * Throws an {@link AndesBatchUpdateException} with specified * information. and rollback the tried batch operation. * //w w w . jav a2 s . c om * @param dataList * data objects will was used for batch operation. * @param connection * SQL connection used. * @param bue * the original SQL batch update exception. * @param task * the string indicating the task tried out (in failed batch * update operation) * @throws AndesBatchUpdateException * the error. */ public <T> void raiseBatchUpdateException(List<T> dataList, Connection connection, BatchUpdateException bue, String task) throws AndesBatchUpdateException { int[] updateCountsOfFailedBatch = bue.getUpdateCounts(); List<T> failed = new ArrayList<T>(); List<T> succeded = new ArrayList<T>(); for (int i = 0; i < updateCountsOfFailedBatch.length; i++) { T msgPart = dataList.get(i); if (Statement.EXECUTE_FAILED == updateCountsOfFailedBatch[i]) { failed.add(msgPart); } else { succeded.add(msgPart); } } rollback(connection, task); // try to rollback the batch operation. AndesBatchUpdateException insertEx = new AndesBatchUpdateException(task + " failed", bue.getSQLState(), bue, failed, succeded); throw insertEx; }
From source file:talonetl.loadpropertyimages_0_1.loadPropertyImages.java
public void tMysqlInput_3Process(final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tMysqlInput_3_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; try {//www . j a v a2 s . co m String currentMethodName = new Exception().getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; row3Struct row3 = new row3Struct(); row4Struct row4 = new row4Struct(); removeDeplicateImageDataStruct removeDeplicateImageData = new removeDeplicateImageDataStruct(); /** * [tMysqlOutput_2 begin ] start */ ok_Hash.put("tMysqlOutput_2", false); start_Hash.put("tMysqlOutput_2", System.currentTimeMillis()); currentComponent = "tMysqlOutput_2"; int tos_count_tMysqlOutput_2 = 0; int deleteKeyCount_tMysqlOutput_2 = 1; if (deleteKeyCount_tMysqlOutput_2 < 1) { throw new RuntimeException("For delete, Schema must have a key"); } int nb_line_tMysqlOutput_2 = 0; int nb_line_update_tMysqlOutput_2 = 0; int nb_line_inserted_tMysqlOutput_2 = 0; int nb_line_deleted_tMysqlOutput_2 = 0; int nb_line_rejected_tMysqlOutput_2 = 0; int deletedCount_tMysqlOutput_2 = 0; int updatedCount_tMysqlOutput_2 = 0; int insertedCount_tMysqlOutput_2 = 0; int rejectedCount_tMysqlOutput_2 = 0; String tableName_tMysqlOutput_2 = "PROPERTY_IMAGES"; boolean whetherReject_tMysqlOutput_2 = false; java.util.Calendar calendar_tMysqlOutput_2 = java.util.Calendar.getInstance(); calendar_tMysqlOutput_2.set(1, 0, 1, 0, 0, 0); long year1_tMysqlOutput_2 = calendar_tMysqlOutput_2.getTime().getTime(); calendar_tMysqlOutput_2.set(10000, 0, 1, 0, 0, 0); long year10000_tMysqlOutput_2 = calendar_tMysqlOutput_2.getTime().getTime(); long date_tMysqlOutput_2; java.sql.Connection conn_tMysqlOutput_2 = null; java.util.Map<String, routines.system.TalendDataSource> dataSources_tMysqlOutput_2 = (java.util.Map<String, routines.system.TalendDataSource>) globalMap .get(KEY_DB_DATASOURCES); if (null != dataSources_tMysqlOutput_2) { conn_tMysqlOutput_2 = dataSources_tMysqlOutput_2.get("").getConnection(); } else { String dbProperties_tMysqlOutput_2 = "noDatetimeStringSync=true"; String url_tMysqlOutput_2 = null; if (dbProperties_tMysqlOutput_2 == null || dbProperties_tMysqlOutput_2.trim().length() == 0) { url_tMysqlOutput_2 = "jdbc:mysql://" + "192.168.1.254" + ":" + "3306" + "/" + "TALONDB" + "?" + "rewriteBatchedStatements=true"; } else { String properties_tMysqlOutput_2 = "noDatetimeStringSync=true"; if (!properties_tMysqlOutput_2.contains("rewriteBatchedStatements")) { properties_tMysqlOutput_2 += "&rewriteBatchedStatements=true"; } url_tMysqlOutput_2 = "jdbc:mysql://" + "192.168.1.254" + ":" + "3306" + "/" + "TALONDB" + "?" + properties_tMysqlOutput_2; } String dbUser_tMysqlOutput_2 = "dbAdmin"; String dbPwd_tMysqlOutput_2 = "1nn0s2013"; java.lang.Class.forName("org.gjt.mm.mysql.Driver"); conn_tMysqlOutput_2 = java.sql.DriverManager.getConnection(url_tMysqlOutput_2, dbUser_tMysqlOutput_2, dbPwd_tMysqlOutput_2); } conn_tMysqlOutput_2.setAutoCommit(false); int commitEvery_tMysqlOutput_2 = 1; int commitCounter_tMysqlOutput_2 = 0; int batchSize_tMysqlOutput_2 = 10000; int batchSizeCounter_tMysqlOutput_2 = 0; int count_tMysqlOutput_2 = 0; String delete_tMysqlOutput_2 = "DELETE FROM `" + "PROPERTY_IMAGES" + "` WHERE `ID` = ?"; java.sql.PreparedStatement pstmt_tMysqlOutput_2 = conn_tMysqlOutput_2 .prepareStatement(delete_tMysqlOutput_2); /** * [tMysqlOutput_2 begin ] stop */ /** * [tMap_3 begin ] start */ ok_Hash.put("tMap_3", false); start_Hash.put("tMap_3", System.currentTimeMillis()); currentComponent = "tMap_3"; int tos_count_tMap_3 = 0; // ############################### // # Lookup's keys initialization // ############################### // ############################### // # Vars initialization class Var__tMap_3__Struct { } Var__tMap_3__Struct Var__tMap_3 = new Var__tMap_3__Struct(); // ############################### // ############################### // # Outputs initialization removeDeplicateImageDataStruct removeDeplicateImageData_tmp = new removeDeplicateImageDataStruct(); // ############################### /** * [tMap_3 begin ] stop */ /** * [tUniqRow_1 begin ] start */ ok_Hash.put("tUniqRow_1", false); start_Hash.put("tUniqRow_1", System.currentTimeMillis()); currentComponent = "tUniqRow_1"; int tos_count_tUniqRow_1 = 0; class KeyStruct_tUniqRow_1 { private static final int DEFAULT_HASHCODE = 1; private static final int PRIME = 31; private int hashCode = DEFAULT_HASHCODE; public boolean hashCodeDirty = true; String TITLE; String SRC_URL; @Override public int hashCode() { if (this.hashCodeDirty) { final int prime = PRIME; int result = DEFAULT_HASHCODE; result = prime * result + ((this.TITLE == null) ? 0 : this.TITLE.hashCode()); result = prime * result + ((this.SRC_URL == null) ? 0 : this.SRC_URL.hashCode()); this.hashCode = result; this.hashCodeDirty = false; } return this.hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final KeyStruct_tUniqRow_1 other = (KeyStruct_tUniqRow_1) obj; if (this.TITLE == null) { if (other.TITLE != null) return false; } else if (!this.TITLE.equals(other.TITLE)) return false; if (this.SRC_URL == null) { if (other.SRC_URL != null) return false; } else if (!this.SRC_URL.equals(other.SRC_URL)) return false; return true; } } int nb_uniques_tUniqRow_1 = 0; int nb_duplicates_tUniqRow_1 = 0; KeyStruct_tUniqRow_1 finder_tUniqRow_1 = new KeyStruct_tUniqRow_1(); java.util.Set<KeyStruct_tUniqRow_1> keystUniqRow_1 = new java.util.HashSet<KeyStruct_tUniqRow_1>(); /** * [tUniqRow_1 begin ] stop */ /** * [tMysqlInput_3 begin ] start */ ok_Hash.put("tMysqlInput_3", false); start_Hash.put("tMysqlInput_3", System.currentTimeMillis()); currentComponent = "tMysqlInput_3"; int tos_count_tMysqlInput_3 = 0; java.util.Calendar calendar_tMysqlInput_3 = java.util.Calendar.getInstance(); calendar_tMysqlInput_3.set(0, 0, 0, 0, 0, 0); java.util.Date year0_tMysqlInput_3 = calendar_tMysqlInput_3.getTime(); int nb_line_tMysqlInput_3 = 0; java.sql.Connection conn_tMysqlInput_3 = null; java.util.Map<String, routines.system.TalendDataSource> dataSources_tMysqlInput_3 = (java.util.Map<String, routines.system.TalendDataSource>) globalMap .get(KEY_DB_DATASOURCES); if (null != dataSources_tMysqlInput_3) { conn_tMysqlInput_3 = dataSources_tMysqlInput_3.get("").getConnection(); } else { java.lang.Class.forName("org.gjt.mm.mysql.Driver"); String url_tMysqlInput_3 = "jdbc:mysql://" + "192.168.1.254" + ":" + "3306" + "/" + "TALONDB" + "?" + "noDatetimeStringSync=true"; String dbUser_tMysqlInput_3 = "dbAdmin"; String dbPwd_tMysqlInput_3 = "1nn0s2013"; conn_tMysqlInput_3 = java.sql.DriverManager.getConnection(url_tMysqlInput_3, dbUser_tMysqlInput_3, dbPwd_tMysqlInput_3); } java.sql.Statement stmt_tMysqlInput_3 = conn_tMysqlInput_3.createStatement(); String dbquery_tMysqlInput_3 = "SELECT `PROPERTY_IMAGES`.`ID`, `PROPERTY_IMAGES`.`TITLE`, `PROPERTY_IMAGES`.`SIZE`, `PROPERTY_IMAGES`.`SRC_URL`, `PROPERTY_IMAGES`.`PROPERTY_DATA_ID` FROM `PROPERTY_IMAGES`"; globalMap.put("tMysqlInput_3_QUERY", dbquery_tMysqlInput_3); java.sql.ResultSet rs_tMysqlInput_3 = stmt_tMysqlInput_3.executeQuery(dbquery_tMysqlInput_3); java.sql.ResultSetMetaData rsmd_tMysqlInput_3 = rs_tMysqlInput_3.getMetaData(); int colQtyInRs_tMysqlInput_3 = rsmd_tMysqlInput_3.getColumnCount(); String tmpContent_tMysqlInput_3 = null; while (rs_tMysqlInput_3.next()) { nb_line_tMysqlInput_3++; if (colQtyInRs_tMysqlInput_3 < 1) { row3.ID = 0; } else { if (rs_tMysqlInput_3.getObject(1) != null) { row3.ID = rs_tMysqlInput_3.getInt(1); } else { throw new RuntimeException("Null value in non-Nullable column"); } } if (colQtyInRs_tMysqlInput_3 < 2) { row3.TITLE = null; } else { tmpContent_tMysqlInput_3 = rs_tMysqlInput_3.getString(2); if (tmpContent_tMysqlInput_3 != null) { row3.TITLE = tmpContent_tMysqlInput_3; } else { row3.TITLE = null; } } if (colQtyInRs_tMysqlInput_3 < 3) { row3.SIZE = 0; } else { if (rs_tMysqlInput_3.getObject(3) != null) { row3.SIZE = rs_tMysqlInput_3.getInt(3); } else { throw new RuntimeException("Null value in non-Nullable column"); } } if (colQtyInRs_tMysqlInput_3 < 4) { row3.SRC_URL = null; } else { tmpContent_tMysqlInput_3 = rs_tMysqlInput_3.getString(4); if (tmpContent_tMysqlInput_3 != null) { row3.SRC_URL = tmpContent_tMysqlInput_3; } else { row3.SRC_URL = null; } } if (colQtyInRs_tMysqlInput_3 < 5) { row3.PROPERTY_DATA_ID = 0; } else { if (rs_tMysqlInput_3.getObject(5) != null) { row3.PROPERTY_DATA_ID = rs_tMysqlInput_3.getInt(5); } else { throw new RuntimeException("Null value in non-Nullable column"); } } /** * [tMysqlInput_3 begin ] stop */ /** * [tMysqlInput_3 main ] start */ currentComponent = "tMysqlInput_3"; tos_count_tMysqlInput_3++; /** * [tMysqlInput_3 main ] stop */ /** * [tUniqRow_1 main ] start */ currentComponent = "tUniqRow_1"; row4 = null; if (row3.TITLE == null) { finder_tUniqRow_1.TITLE = null; } else { finder_tUniqRow_1.TITLE = row3.TITLE.toLowerCase(); } if (row3.SRC_URL == null) { finder_tUniqRow_1.SRC_URL = null; } else { finder_tUniqRow_1.SRC_URL = row3.SRC_URL.toLowerCase(); } finder_tUniqRow_1.hashCodeDirty = true; if (!keystUniqRow_1.contains(finder_tUniqRow_1)) { KeyStruct_tUniqRow_1 new_tUniqRow_1 = new KeyStruct_tUniqRow_1(); if (row3.TITLE == null) { new_tUniqRow_1.TITLE = null; } else { new_tUniqRow_1.TITLE = row3.TITLE.toLowerCase(); } if (row3.SRC_URL == null) { new_tUniqRow_1.SRC_URL = null; } else { new_tUniqRow_1.SRC_URL = row3.SRC_URL.toLowerCase(); } keystUniqRow_1.add(new_tUniqRow_1); nb_uniques_tUniqRow_1++; } else { if (row4 == null) { row4 = new row4Struct(); } row4.ID = row3.ID; row4.TITLE = row3.TITLE; row4.SIZE = row3.SIZE; row4.SRC_URL = row3.SRC_URL; row4.PROPERTY_DATA_ID = row3.PROPERTY_DATA_ID; nb_duplicates_tUniqRow_1++; } tos_count_tUniqRow_1++; /** * [tUniqRow_1 main ] stop */ // Start of branch "row4" if (row4 != null) { /** * [tMap_3 main ] start */ currentComponent = "tMap_3"; boolean hasCasePrimitiveKeyWithNull_tMap_3 = false; // ############################### // # Input tables (lookups) boolean rejectedInnerJoin_tMap_3 = false; boolean mainRowRejected_tMap_3 = false; // ############################### { // start of Var scope // ############################### // # Vars tables Var__tMap_3__Struct Var = Var__tMap_3;// ############################### // ############################### // # Output tables removeDeplicateImageData = null; // # Output table : 'removeDeplicateImageData' removeDeplicateImageData_tmp.ID = row4.ID; removeDeplicateImageData_tmp.TITLE = row4.TITLE; removeDeplicateImageData_tmp.SIZE = row4.SIZE; removeDeplicateImageData_tmp.SRC_URL = row4.SRC_URL; removeDeplicateImageData_tmp.PROPERTY_DATA_ID = row4.PROPERTY_DATA_ID; removeDeplicateImageData = removeDeplicateImageData_tmp; // ############################### } // end of Var scope rejectedInnerJoin_tMap_3 = false; tos_count_tMap_3++; /** * [tMap_3 main ] stop */ // Start of branch "removeDeplicateImageData" if (removeDeplicateImageData != null) { /** * [tMysqlOutput_2 main ] start */ currentComponent = "tMysqlOutput_2"; whetherReject_tMysqlOutput_2 = false; pstmt_tMysqlOutput_2.setInt(1, removeDeplicateImageData.ID); pstmt_tMysqlOutput_2.addBatch(); nb_line_tMysqlOutput_2++; batchSizeCounter_tMysqlOutput_2++; nb_line_tMysqlOutput_2++; if (batchSize_tMysqlOutput_2 <= batchSizeCounter_tMysqlOutput_2) { try { int countSum_tMysqlOutput_2 = 0; for (int countEach_tMysqlOutput_2 : pstmt_tMysqlOutput_2.executeBatch()) { countSum_tMysqlOutput_2 += (countEach_tMysqlOutput_2 < 0 ? 0 : countEach_tMysqlOutput_2); } deletedCount_tMysqlOutput_2 += countSum_tMysqlOutput_2; batchSizeCounter_tMysqlOutput_2 = 0; } catch (java.sql.BatchUpdateException e) { int countSum_tMysqlOutput_2 = 0; for (int countEach_tMysqlOutput_2 : e.getUpdateCounts()) { countSum_tMysqlOutput_2 += (countEach_tMysqlOutput_2 < 0 ? 0 : countEach_tMysqlOutput_2); } deletedCount_tMysqlOutput_2 += countSum_tMysqlOutput_2; System.err.println(e.getMessage()); } } commitCounter_tMysqlOutput_2++; if (commitEvery_tMysqlOutput_2 <= commitCounter_tMysqlOutput_2) { try { int countSum_tMysqlOutput_2 = 0; for (int countEach_tMysqlOutput_2 : pstmt_tMysqlOutput_2.executeBatch()) { countSum_tMysqlOutput_2 += (countEach_tMysqlOutput_2 < 0 ? 0 : countEach_tMysqlOutput_2); } deletedCount_tMysqlOutput_2 += countSum_tMysqlOutput_2; } catch (java.sql.BatchUpdateException e) { int countSum_tMysqlOutput_2 = 0; for (int countEach_tMysqlOutput_2 : e.getUpdateCounts()) { countSum_tMysqlOutput_2 += (countEach_tMysqlOutput_2 < 0 ? 0 : countEach_tMysqlOutput_2); } deletedCount_tMysqlOutput_2 += countSum_tMysqlOutput_2; System.out.println(e.getMessage()); } conn_tMysqlOutput_2.commit(); commitCounter_tMysqlOutput_2 = 0; } tos_count_tMysqlOutput_2++; /** * [tMysqlOutput_2 main ] stop */ } // End of branch "removeDeplicateImageData" } // End of branch "row4" /** * [tMysqlInput_3 end ] start */ currentComponent = "tMysqlInput_3"; } rs_tMysqlInput_3.close(); stmt_tMysqlInput_3.close(); conn_tMysqlInput_3.close(); globalMap.put("tMysqlInput_3_NB_LINE", nb_line_tMysqlInput_3); ok_Hash.put("tMysqlInput_3", true); end_Hash.put("tMysqlInput_3", System.currentTimeMillis()); /** * [tMysqlInput_3 end ] stop */ /** * [tUniqRow_1 end ] start */ currentComponent = "tUniqRow_1"; globalMap.put("tUniqRow_1_NB_UNIQUES", nb_uniques_tUniqRow_1); globalMap.put("tUniqRow_1_NB_DUPLICATES", nb_duplicates_tUniqRow_1); ok_Hash.put("tUniqRow_1", true); end_Hash.put("tUniqRow_1", System.currentTimeMillis()); /** * [tUniqRow_1 end ] stop */ /** * [tMap_3 end ] start */ currentComponent = "tMap_3"; // ############################### // # Lookup hashes releasing // ############################### ok_Hash.put("tMap_3", true); end_Hash.put("tMap_3", System.currentTimeMillis()); /** * [tMap_3 end ] stop */ /** * [tMysqlOutput_2 end ] start */ currentComponent = "tMysqlOutput_2"; try { if (pstmt_tMysqlOutput_2 != null) { int countSum_tMysqlOutput_2 = 0; for (int countEach_tMysqlOutput_2 : pstmt_tMysqlOutput_2.executeBatch()) { countSum_tMysqlOutput_2 += (countEach_tMysqlOutput_2 < 0 ? 0 : countEach_tMysqlOutput_2); } deletedCount_tMysqlOutput_2 += countSum_tMysqlOutput_2; } } catch (java.sql.BatchUpdateException e) { int countSum_tMysqlOutput_2 = 0; for (int countEach_tMysqlOutput_2 : e.getUpdateCounts()) { countSum_tMysqlOutput_2 += (countEach_tMysqlOutput_2 < 0 ? 0 : countEach_tMysqlOutput_2); } deletedCount_tMysqlOutput_2 += countSum_tMysqlOutput_2; System.out.println(e.getMessage()); } if (pstmt_tMysqlOutput_2 != null) { pstmt_tMysqlOutput_2.close(); } conn_tMysqlOutput_2.commit(); conn_tMysqlOutput_2.close(); nb_line_deleted_tMysqlOutput_2 = nb_line_deleted_tMysqlOutput_2 + deletedCount_tMysqlOutput_2; nb_line_update_tMysqlOutput_2 = nb_line_update_tMysqlOutput_2 + updatedCount_tMysqlOutput_2; nb_line_inserted_tMysqlOutput_2 = nb_line_inserted_tMysqlOutput_2 + insertedCount_tMysqlOutput_2; nb_line_rejected_tMysqlOutput_2 = nb_line_rejected_tMysqlOutput_2 + rejectedCount_tMysqlOutput_2; globalMap.put("tMysqlOutput_2_NB_LINE", nb_line_tMysqlOutput_2); globalMap.put("tMysqlOutput_2_NB_LINE_UPDATED", nb_line_update_tMysqlOutput_2); globalMap.put("tMysqlOutput_2_NB_LINE_INSERTED", nb_line_inserted_tMysqlOutput_2); globalMap.put("tMysqlOutput_2_NB_LINE_DELETED", nb_line_deleted_tMysqlOutput_2); globalMap.put("tMysqlOutput_2_NB_LINE_REJECTED", nb_line_rejected_tMysqlOutput_2); ok_Hash.put("tMysqlOutput_2", true); end_Hash.put("tMysqlOutput_2", System.currentTimeMillis()); /** * [tMysqlOutput_2 end ] stop */ } // end the resume } catch (Exception e) { throw new TalendException(e, currentComponent, globalMap); } catch (java.lang.Error error) { throw new java.lang.Error(error); } globalMap.put("tMysqlInput_3_SUBPROCESS_STATE", 1); }