From 23ae44fba7408e56085403034ce85728a57e9044 Mon Sep 17 00:00:00 2001 From: rusher Date: Wed, 24 Jan 2024 17:21:48 +0100 Subject: [PATCH] [CONJ-1152] Improve message when reaching socket timeout during connection initial commands --- .../org/mariadb/jdbc/client/impl/StandardClient.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/mariadb/jdbc/client/impl/StandardClient.java b/src/main/java/org/mariadb/jdbc/client/impl/StandardClient.java index ccb93465d..2e1a87906 100644 --- a/src/main/java/org/mariadb/jdbc/client/impl/StandardClient.java +++ b/src/main/java/org/mariadb/jdbc/client/impl/StandardClient.java @@ -6,6 +6,7 @@ import java.io.*; import java.net.Socket; import java.net.SocketException; +import java.net.SocketTimeoutException; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.SQLNonTransientConnectionException; @@ -441,7 +442,8 @@ public String createSessionVariableQuery(String serverTz, Context context) { && (context.getVersion().versionGreaterOrEqual(10, 2, 2))) || context.getVersion().versionGreaterOrEqual(5, 7, 0))) { sessionCommands.add( - "session_track_system_variables = CONCAT(@@global.session_track_system_variables,',auto_increment_increment')"); + "session_track_system_variables =" + + " CONCAT(@@global.session_track_system_variables,',auto_increment_increment')"); } // add configured session variable if configured @@ -933,7 +935,12 @@ public Completion readPacket( destroySocket(); throw exceptionFactory .withSql(message.description()) - .create("Socket error", "08000", ioException); + .create( + ioException instanceof SocketTimeoutException + ? "Socket timout error" + : "Socket error", + "08000", + ioException); } }