From 905d9ff8358b0bc2b604f288b921f984526de1e0 Mon Sep 17 00:00:00 2001 From: wudi <676366545@qq.com> Date: Tue, 5 Mar 2024 15:24:04 +0800 Subject: [PATCH] fix --- .../doris/flink/tools/cdc/MySQLDorisE2ECase.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/flink-doris-connector/src/test/java/org/apache/doris/flink/tools/cdc/MySQLDorisE2ECase.java b/flink-doris-connector/src/test/java/org/apache/doris/flink/tools/cdc/MySQLDorisE2ECase.java index 3390f7553..f93088f1f 100644 --- a/flink-doris-connector/src/test/java/org/apache/doris/flink/tools/cdc/MySQLDorisE2ECase.java +++ b/flink-doris-connector/src/test/java/org/apache/doris/flink/tools/cdc/MySQLDorisE2ECase.java @@ -276,7 +276,10 @@ public void testAutoAddTable() throws Exception { } private void initializeDorisTable() throws Exception { - try (Statement statement = connection.createStatement()) { + try (Connection connection = + DriverManager.getConnection( + String.format(URL, DORIS_CONTAINER.getHost()), USERNAME, PASSWORD); + Statement statement = connection.createStatement()) { statement.execute(String.format("DROP TABLE IF EXISTS %s.%s", DATABASE, TABLE_1)); statement.execute(String.format("DROP TABLE IF EXISTS %s.%s", DATABASE, TABLE_2)); statement.execute(String.format("DROP TABLE IF EXISTS %s.%s", DATABASE, TABLE_3)); @@ -287,8 +290,11 @@ private void initializeDorisTable() throws Exception { public void checkResult(Set> expected, String query, int columnSize) throws Exception { Set> actual = new HashSet<>(); - try (Statement sinkStatement = connection.createStatement()) { - ResultSet sinkResultSet = sinkStatement.executeQuery(query); + try (Connection connection = + DriverManager.getConnection( + String.format(URL, DORIS_CONTAINER.getHost()), USERNAME, PASSWORD); + Statement statement = connection.createStatement()) { + ResultSet sinkResultSet = statement.executeQuery(query); while (sinkResultSet.next()) { List row = new ArrayList<>(); for (int i = 1; i <= columnSize; i++) {