This is an automated email from the ASF dual-hosted git repository.
ppa pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 5c66de1ad45 IGNITE-27300 Jdbc. Improved compatibility error message
(#7211)
5c66de1ad45 is described below
commit 5c66de1ad455bba9f7496dc2ebe6c319dd0b0b6e
Author: Pavel Pereslegin <[email protected]>
AuthorDate: Thu Dec 11 17:24:55 2025 +0300
IGNITE-27300 Jdbc. Improved compatibility error message (#7211)
---
.../JdbcOverThinSqlWithOldServerCompatibilityTest.java | 13 +++++++++----
.../main/java/org/apache/ignite/jdbc/IgniteJdbcDriver.java | 8 ++++++--
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git
a/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/client/JdbcOverThinSqlWithOldServerCompatibilityTest.java
b/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/client/JdbcOverThinSqlWithOldServerCompatibilityTest.java
index a0675e9c5aa..07cb036aced 100644
---
a/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/client/JdbcOverThinSqlWithOldServerCompatibilityTest.java
+++
b/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/client/JdbcOverThinSqlWithOldServerCompatibilityTest.java
@@ -19,16 +19,18 @@ package org.apache.ignite.internal.client;
import static
org.apache.ignite.internal.testframework.IgniteTestUtils.assertThrows;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.matchesPattern;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.List;
+import java.util.regex.Pattern;
import org.apache.ignite.Ignite;
import org.apache.ignite.client.IgniteClientConnectionException;
import org.apache.ignite.internal.CompatibilityTestBase;
+import org.apache.ignite.internal.properties.IgniteProductVersion;
import org.apache.ignite.lang.ErrorGroups.Client;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedClass;
@@ -73,10 +75,13 @@ public class JdbcOverThinSqlWithOldServerCompatibilityTest
extends Compatibility
IgniteClientConnectionException connectEx =
(IgniteClientConnectionException) cause;
+ String expectedDriverVer =
Pattern.quote(IgniteProductVersion.CURRENT_VERSION.toString());
+
assertThat(connectEx.getMessage(),
- containsString("Connection to node aborted, because the node
does not support the feature required "
- + "by the driver being used. Please refer to the
documentation and use a compatible version "
- + "of the JDBC driver to connect to this node"));
+ matchesPattern("Connection to node aborted, because the node
does not support the feature required "
+ + "by the driver being used\\. Please refer to the
documentation and use a compatible version "
+ + "of the JDBC driver to connect to this node "
+ + "\\[nodeName=.+, nodeAddress=.+, nodeVersion=.+,
driverVersion=" + expectedDriverVer + ']'));
assertThat(connectEx.code(), is(Client.CONNECTION_ERR));
}
}
diff --git
a/modules/jdbc/src/main/java/org/apache/ignite/jdbc/IgniteJdbcDriver.java
b/modules/jdbc/src/main/java/org/apache/ignite/jdbc/IgniteJdbcDriver.java
index cf1048df039..99acf4c96ec 100644
--- a/modules/jdbc/src/main/java/org/apache/ignite/jdbc/IgniteJdbcDriver.java
+++ b/modules/jdbc/src/main/java/org/apache/ignite/jdbc/IgniteJdbcDriver.java
@@ -52,6 +52,7 @@ import org.apache.ignite.internal.jdbc.JdbcConnection;
import org.apache.ignite.internal.jdbc.JdbcDatabaseMetadata;
import org.apache.ignite.internal.jdbc.proto.JdbcDatabaseMetadataHandler;
import org.apache.ignite.internal.lang.IgniteStringFormatter;
+import org.apache.ignite.internal.properties.IgniteProductVersion;
import org.apache.ignite.network.ClusterNode;
import org.jetbrains.annotations.Nullable;
@@ -196,6 +197,9 @@ public class IgniteJdbcDriver implements Driver {
/** Minor version. */
private static final int MINOR_VER = ProtocolVersion.LATEST_VER.minor();
+ /** Full version string. */
+ private static final String FULL_VER =
IgniteProductVersion.CURRENT_VERSION.toString();
+
/**
* Tracker of the latest time observed by client.
*
@@ -333,8 +337,8 @@ public class IgniteJdbcDriver implements Driver {
IgniteStringFormatter.format("Connection to node
aborted, because the node does not support "
+ "the feature required by the driver being
used. Please refer to the documentation and use a compatible "
+ "version of the JDBC driver to connect to
this node "
- + "[name={}, address={}, productVersion={},
driverVersion={}.{}]",
- node.name(), node.address(),
ctx.productVersion(), getMajorVersion(), getMinorVersion()),
+ + "[nodeName={}, nodeAddress={},
nodeVersion={}, driverVersion={}]",
+ node.name(), node.address(),
ctx.productVersion(), FULL_VER),
null
);
}