Skip to content

Increased the max noOfRedirections and updated the message. #2659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3690,7 +3690,7 @@

// indicates the no of times the connection was routed to a different server
int noOfRedirections = 0;

int maxNoOfRedirections = 10;
// Only three ways out of this loop:
// 1) Successfully connected
// 2) Parser threw exception while main timer was expired
Expand Down Expand Up @@ -3764,9 +3764,10 @@
.fine(toString() + " Connection open - redirection count: " + noOfRedirections);
}

if (noOfRedirections > 1) {
String msg = SQLServerException.getErrString("R_multipleRedirections");
terminate(SQLServerException.DRIVER_ERROR_UNSUPPORTED_CONFIG, msg);
if (noOfRedirections > maxNoOfRedirections) {
MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_multipleRedirections"));
Object[] msgArgs = {maxNoOfRedirections};
terminate(SQLServerException.DRIVER_ERROR_UNSUPPORTED_CONFIG, form.format(msgArgs));

Check warning on line 3770 in src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java#L3768-L3770

Added lines #L3768 - L3770 were not covered by tests
}

// close tds channel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected Object[][] getContents() {
// LOCALIZE THIS
{"R_timedOutBeforeRouting", "The timeout expired before connecting to the routing destination."},
{"R_invalidRoutingInfo", "Unexpected routing information received. Please check your connection properties and SQL Server configuration."},
{"R_multipleRedirections", "Two or more redirections have occurred. Only one redirection per login attempt is allowed."},
{"R_multipleRedirections", "Too many redirections have occurred. Only {0} redirections per login is allowed."},
{"R_dbMirroringWithMultiSubnetFailover", "Connecting to a mirrored SQL Server instance using the multiSubnetFailover connection property is not supported."},
{"R_dbMirroringWithReadOnlyIntent", "Connecting to a mirrored SQL Server instance using the ApplicationIntent ReadOnly connection property is not supported."},
{"R_ipAddressLimitWithMultiSubnetFailover", "Connecting with the multiSubnetFailover connection property to a SQL Server instance configured with more than {0} IP addresses is not supported."},
Expand Down
Loading