Skip to content

Commit dd170b3

Browse files
divangDivang Sharma
andcommitted
Increased the max noOfRedirections and updated the message. (#2659)
Co-authored-by: Divang Sharma <divangsharma@microsoft.com>
1 parent 5fb29dd commit dd170b3

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3642,7 +3642,7 @@ private void login(String primary, String primaryInstanceName, int primaryPortNu
36423642

36433643
// indicates the no of times the connection was routed to a different server
36443644
int noOfRedirections = 0;
3645-
3645+
int maxNoOfRedirections = 10;
36463646
// Only three ways out of this loop:
36473647
// 1) Successfully connected
36483648
// 2) Parser threw exception while main timer was expired
@@ -3716,9 +3716,10 @@ private void login(String primary, String primaryInstanceName, int primaryPortNu
37163716
.fine(toString() + " Connection open - redirection count: " + noOfRedirections);
37173717
}
37183718

3719-
if (noOfRedirections > 1) {
3720-
String msg = SQLServerException.getErrString("R_multipleRedirections");
3721-
terminate(SQLServerException.DRIVER_ERROR_UNSUPPORTED_CONFIG, msg);
3719+
if (noOfRedirections > maxNoOfRedirections) {
3720+
MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_multipleRedirections"));
3721+
Object[] msgArgs = {maxNoOfRedirections};
3722+
terminate(SQLServerException.DRIVER_ERROR_UNSUPPORTED_CONFIG, form.format(msgArgs));
37223723
}
37233724

37243725
// close tds channel

src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected Object[][] getContents() {
4141
// LOCALIZE THIS
4242
{"R_timedOutBeforeRouting", "The timeout expired before connecting to the routing destination."},
4343
{"R_invalidRoutingInfo", "Unexpected routing information received. Please check your connection properties and SQL Server configuration."},
44-
{"R_multipleRedirections", "Two or more redirections have occurred. Only one redirection per login attempt is allowed."},
44+
{"R_multipleRedirections", "Too many redirections have occurred. Only {0} redirections per login is allowed."},
4545
{"R_dbMirroringWithMultiSubnetFailover", "Connecting to a mirrored SQL Server instance using the multiSubnetFailover connection property is not supported."},
4646
{"R_dbMirroringWithReadOnlyIntent", "Connecting to a mirrored SQL Server instance using the ApplicationIntent ReadOnly connection property is not supported."},
4747
{"R_ipAddressLimitWithMultiSubnetFailover", "Connecting with the multiSubnetFailover connection property to a SQL Server instance configured with more than {0} IP addresses is not supported."},

0 commit comments

Comments
 (0)