From 9946b2201801bfee4cea8fb1b262bdc8f89dc7c9 Mon Sep 17 00:00:00 2001 From: EchoLee5 <39044001+EchoLee5@users.noreply.github.com> Date: Mon, 22 May 2023 16:28:57 +0800 Subject: [PATCH] [Hotfix][Connector][Jdbc] Fix the problem of JdbcOutputFormat database connection leak [Hotfix][Connector][Jdbc] Fix the problem of JdbcOutputFormat database connection leak --- .../seatunnel/jdbc/internal/JdbcOutputFormat.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 ee3c4a7a68b..d47814f1531 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 @@ -219,10 +219,11 @@ public synchronized void close() { flush(); } catch (Exception e) { LOG.warn("Writing records to JDBC failed.", e); - throw new JdbcConnectorException( - CommonErrorCode.FLUSH_DATA_FAILED, - "Writing records to JDBC failed.", - e); + flushException = + new JdbcConnectorException( + CommonErrorCode.FLUSH_DATA_FAILED, + "Writing records to JDBC failed.", + e); } }