leosanqing commented on code in PR #5280:
URL: https://github.com/apache/inlong/pull/5280#discussion_r933978195
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/oracle/OracleJdbcUtils.java:
##########
@@ -108,14 +108,16 @@ public static ResultSet executeQuerySql(Connection conn,
String sql)
* @param sqls SQL string to be executed
* @throws Exception on get execute SQL batch error
*/
- public static void executeSqlBatch(Connection conn, List<String> sqls)
- throws Exception {
+ public static void executeSqlBatch(Connection conn, List<String> sqls)
throws Exception {
+ conn.setAutoCommit(false);
Statement stmt = conn.createStatement();
for (String entry : sqls) {
stmt.execute(entry);
}
+ conn.commit();
+ conn.setAutoCommit(true);
+ LOG.info("execute batch sql [{}] success", sqls);
stmt.close();
Review Comment:
It would be better to use Try-with-resources,or close the stream in finally,
the commit commit throws an exception, and the stream cannot be closed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]