Skip to content

Commit f0706ea

Browse files
divangDivang Sharma
andauthored
Increased the max noOfRedirections and updated the message. (#2659)
Co-authored-by: Divang Sharma <[email protected]>
1 parent 02673d8 commit f0706ea

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
@@ -3690,7 +3690,7 @@ private void login(String primary, String primaryInstanceName, int primaryPortNu
36903690

36913691
// indicates the no of times the connection was routed to a different server
36923692
int noOfRedirections = 0;
3693-
3693+
int maxNoOfRedirections = 10;
36943694
// Only three ways out of this loop:
36953695
// 1) Successfully connected
36963696
// 2) Parser threw exception while main timer was expired
@@ -3764,9 +3764,10 @@ private void login(String primary, String primaryInstanceName, int primaryPortNu
37643764
.fine(toString() + " Connection open - redirection count: " + noOfRedirections);
37653765
}
37663766

3767-
if (noOfRedirections > 1) {
3768-
String msg = SQLServerException.getErrString("R_multipleRedirections");
3769-
terminate(SQLServerException.DRIVER_ERROR_UNSUPPORTED_CONFIG, msg);
3767+
if (noOfRedirections > maxNoOfRedirections) {
3768+
MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_multipleRedirections"));
3769+
Object[] msgArgs = {maxNoOfRedirections};
3770+
terminate(SQLServerException.DRIVER_ERROR_UNSUPPORTED_CONFIG, form.format(msgArgs));
37703771
}
37713772

37723773
// 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)