in adb2client/src/main/java/com/alibaba/cloud/analyticdb/adbclient/AdbClient.java [1131:1164]
private void executeEachRow(StringBuilder sb) {
Statement stmt = null;
Connection conn = null;
try {
conn = this.getConnection();
stmt = conn.createStatement();
} catch (SQLException ec) {
closeDBResources(null, stmt, conn);
throw new AdbClientException(AdbClientException.CREATE_CONNECTION_ERROR, "Creating statement and connection failed when commit: " + ec.getMessage(), ec);
}
Map<String, String[]> splitSqlMap = splitBatchSql(sb);
for (Map.Entry<String, String[]> entry : splitSqlMap.entrySet()) {
for (String splitSql : entry.getValue()) {
try {
stmt.execute(insertSqlPrefix.get(entry.getKey()) + splitSql);
} catch (Exception ex) {
closeDBResources(null, stmt, conn);
try {
conn = this.getConnection();
stmt = conn.createStatement();
} catch (SQLException ec) {
closeDBResources(null, stmt, conn);
throw new AdbClientException(AdbClientException.CREATE_CONNECTION_ERROR, "Creating statement and connection failed when commit: " + ec.getMessage(), ec);
}
if (!databaseConfig.isIgnoreInsertError()) {
commitExceptionDataList.add(splitSql);
} else {
exceptionCount.incrementAndGet();
}
}
}
}
closeDBResources(null, stmt, conn);
}