wanglijie95 commented on a change in pull request #12427:
URL: https://github.com/apache/flink/pull/12427#discussion_r435676536



##########
File path: 
flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/internal/executor/InsertOrUpdateJdbcExecutor.java
##########
@@ -83,6 +88,21 @@ public void open(Connection connection) throws SQLException {
                updateStatement = connection.prepareStatement(updateSQL);
        }
 
+       @Override
+       public void reopen(Connection connection) throws SQLException {
+               try {
+                       existStatement.close();
+                       insertStatement.close();
+                       updateStatement.close();
+               } catch (SQLException e) {
+                       LOG.info("PreparedStatement close failed.", e);
+               }
+
+               existStatement = connection.prepareStatement(existSQL);
+               insertStatement = connection.prepareStatement(insertSQL);
+               updateStatement = connection.prepareStatement(updateSQL);

Review comment:
       Hi @wuchong , I have checked the implementation of `open` and `close`. 
The `reopen` is not the simple combination of `close` and `open`. The 
difference is that `close` will clear the `batch` map. It's not what we wan't. 
   
   So we need to introduce a new `reopen` interface. 




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to