diff --git a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/JdbcOutputFormat.java b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/JdbcOutputFormat.java index 873a542f5e9..ee3c4a7a68b 100644 --- a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/JdbcOutputFormat.java +++ b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/JdbcOutputFormat.java @@ -239,7 +239,14 @@ public synchronized void close() { } public void updateExecutor(boolean reconnect) throws SQLException, ClassNotFoundException { - jdbcStatementExecutor.closeStatements(); + try { + jdbcStatementExecutor.closeStatements(); + } catch (SQLException e) { + if (!reconnect) { + throw e; + } + LOG.error("Close JDBC statement failed on reconnect.", e); + } jdbcStatementExecutor.prepareStatements( reconnect ? connectionProvider.reestablishConnection()