Commit cc9284d 1 parent d83f05e commit cc9284d Copy full SHA for cc9284d
File tree 1 file changed +9
-5
lines changed
src/main/java/com/microsoft/sqlserver/jdbc
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -1015,15 +1015,19 @@ public int getMaxColumnsInTable() throws SQLServerException {
1015
1015
public int getMaxConnections () throws SQLException , SQLTimeoutException {
1016
1016
checkClosed ();
1017
1017
try {
1018
- String s = "select maximum from sys.configurations where name = 'user connections'" ;
1019
- SQLServerResultSet rs = getResultSetFromInternalQueries (null , s );
1020
- if (!rs .next ())
1021
- return 0 ;
1018
+ SQLServerResultSet rs = getResultSetFromInternalQueries (null ,
1019
+ "select maximum from sys.configurations where name = 'user connections'" );
1020
+ if (!rs .next ()) {
1021
+ // Try with sp_configure if users do not have privileges to execute sys.configurations
1022
+ rs = getResultSetFromInternalQueries (null , "sp_configure 'user connections'" );
1023
+ if (!rs .next ()) {
1024
+ return 0 ;
1025
+ }
1026
+ }
1022
1027
return rs .getInt ("maximum" );
1023
1028
} catch (SQLServerException e ) {
1024
1029
return 0 ;
1025
1030
}
1026
-
1027
1031
}
1028
1032
1029
1033
@ Override
You can’t perform that action at this time.
0 commit comments