Skip to content

Commit

Permalink
[CONJ-1152] Improve message when reaching socket timeout during conne…
Browse files Browse the repository at this point in the history
…ction initial commands
  • Loading branch information
rusher committed Jan 24, 2024
1 parent 8094896 commit 23ae44f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/org/mariadb/jdbc/client/impl/StandardClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 23ae44f

Please sign in to comment.