private void executeBatchSql()

in adb2client/src/main/java/com/alibaba/cloud/analyticdb/adbclient/AdbClient.java [1091:1124]


    private void executeBatchSql(StringBuilder sb) {
        if (sb.length() != 0) {
            int retryNum = 0;
            Connection conn = null;
            Statement stmt = null;
            while (retryNum <= databaseConfig.getRetryTimes()) {
                try {
                    conn = this.getConnection();
                    stmt = conn.createStatement();
                    stmt.execute(sb.toString());
                    break;
//                } catch (MySQLSyntaxErrorException e) {
//                    if (databaseConfig.isInsertExceptionSplit()) {
//                        commitException = e;
//                        executeEachRow(sb);
//                        break;
//                    }
                } catch (Exception e) {
                    if (retryNum == databaseConfig.getRetryTimes()) {
                        logger("error", sb.toString());
                        throw new AdbClientException(AdbClientException.COMMIT_ERROR_OTHER, String.format("Commit failed after %s times retry, please commit again later! Detail of exception is %s", retryNum, e.getMessage()), e);
                    }
                } finally {
                    closeDBResources(null, stmt, conn);
                }
                retryNum++;
                try {
                    TimeUnit.MILLISECONDS.sleep(databaseConfig.getRetryIntervalTime());
                } catch (InterruptedException e) {
                    logger("error", "commit error " + e.getMessage());
                }
            }
        }
    }