From 8c293a58473577f5f962ac2817956badc31d401a Mon Sep 17 00:00:00 2001 From: alexradzin Date: Mon, 11 Sep 2023 16:54:36 +0300 Subject: [PATCH] FIR-26385 send additional parameters to real engine only --- .../integration/tests/ConnectionTest.java | 31 +++++++++++++++++++ .../jdbc/connection/FireboltConnection.java | 1 + 2 files changed, 32 insertions(+) create mode 100644 src/integrationTest/java/integration/tests/ConnectionTest.java diff --git a/src/integrationTest/java/integration/tests/ConnectionTest.java b/src/integrationTest/java/integration/tests/ConnectionTest.java new file mode 100644 index 000000000..2169c76e4 --- /dev/null +++ b/src/integrationTest/java/integration/tests/ConnectionTest.java @@ -0,0 +1,31 @@ +package integration.tests; + +import integration.ConnectionInfo; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +import static java.lang.String.format; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +public class ConnectionTest { + /** + * This test connects to specific engine with additional property {@code use_standard_sql} supported by user engine but + * not supported by system engine used here to retrieve the data of user engine. + * The test is needed because there were create connection to system engine by copying all given connection properties + * while additional (custom) parameters should be ignored. + * @throws SQLException if something went wrong + */ + @Test + void connectionWithAdditionalProperties() throws SQLException { + ConnectionInfo params = integration.ConnectionInfo.getInstance(); + String url = format("jdbc:firebolt:%s?env=%s&engine=%s&account=%s&use_standard_sql=1", params.getDatabase(), params.getEnv(), params.getEngine(), params.getAccount()); + try(Connection connection = DriverManager.getConnection(url, params.getPrincipal(), params.getSecret())) { + assertNotNull(connection); + } + } +} diff --git a/src/main/java/com/firebolt/jdbc/connection/FireboltConnection.java b/src/main/java/com/firebolt/jdbc/connection/FireboltConnection.java index 803e3e60a..660d8f263 100644 --- a/src/main/java/com/firebolt/jdbc/connection/FireboltConnection.java +++ b/src/main/java/com/firebolt/jdbc/connection/FireboltConnection.java @@ -182,6 +182,7 @@ private FireboltProperties createInternalSystemEngineProperties(String accessTok return this.loginProperties .toBuilder() .systemEngine(true) + .additionalProperties(Map.of()) .compress(false) .host(UrlUtil.createUrl(systemEngineEndpoint).getHost()).database(null).build(); }