From b27964d20291c4a4d5371dbddb363f679ae72ad1 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Wed, 4 Sep 2024 15:34:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=A0=A1=E9=AA=8C=20ck=20=E5=87=BA?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datasource/provider/CalciteProvider.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/datasource/provider/CalciteProvider.java b/core/core-backend/src/main/java/io/dataease/datasource/provider/CalciteProvider.java index f797243a73..2cd508cd17 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/provider/CalciteProvider.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/provider/CalciteProvider.java @@ -128,8 +128,18 @@ public class CalciteProvider extends Provider { default: break; } - String querySql = getTablesSql(datasourceRequest).get(0); - try (ConnectionObj con = getConnection(datasourceRequest.getDatasource()); Statement statement = getStatement(con.getConnection(), 30); ResultSet resultSet = statement.executeQuery(querySql)) { + + try (ConnectionObj con = getConnection(datasourceRequest.getDatasource())) { + datasourceRequest.setDsVersion(con.getConnection().getMetaData().getDatabaseMajorVersion()); + String querySql = getTablesSql(datasourceRequest).get(0); + Statement statement = getStatement(con.getConnection(), 30); + ResultSet resultSet = statement.executeQuery(querySql); + if (resultSet != null) { + resultSet.close(); + } + if (statement != null) { + statement.close(); + } } catch (Exception e) { throw e; }