Commit 6cc07a8 1 parent 3fd3e60 commit 6cc07a8 Copy full SHA for 6cc07a8
File tree 1 file changed +12
-5
lines changed
src/main/java/com/microsoft/sqlserver/jdbc
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 28
28
* The API javadoc for JDBC API methods that this class implements are not repeated here. Please see Sun's JDBC API
29
29
* interfaces javadoc for those details.
30
30
*/
31
+ @ SuppressWarnings ("unused" )
31
32
public final class SQLServerDatabaseMetaData implements java .sql .DatabaseMetaData , Serializable {
32
33
/**
33
34
* Always update serialVersionUID when prompted.
@@ -1014,19 +1015,25 @@ public int getMaxColumnsInTable() throws SQLServerException {
1014
1015
@ Override
1015
1016
public int getMaxConnections () throws SQLException , SQLTimeoutException {
1016
1017
checkClosed ();
1018
+ SQLServerResultSet rs = null ;
1017
1019
try {
1018
- SQLServerResultSet rs = getResultSetFromInternalQueries (null ,
1020
+ rs = getResultSetFromInternalQueries (null ,
1019
1021
"select maximum from sys.configurations where name = 'user connections'" );
1020
1022
if (!rs .next ()) {
1021
- // Try with sp_configure if users do not have privileges to execute sys.configurations
1023
+ return 0 ;
1024
+ }
1025
+ return rs .getInt ("maximum" );
1026
+ } catch (SQLServerException e ) {
1027
+ // Try with sp_configure if users do not have privileges to execute sys.configurations
1028
+ try {
1022
1029
rs = getResultSetFromInternalQueries (null , "sp_configure 'user connections'" );
1023
1030
if (!rs .next ()) {
1024
1031
return 0 ;
1025
1032
}
1033
+ return rs .getInt ("maximum" );
1034
+ } catch (SQLServerException e1 ) {
1035
+ return 0 ;
1026
1036
}
1027
- return rs .getInt ("maximum" );
1028
- } catch (SQLServerException e ) {
1029
- return 0 ;
1030
1037
}
1031
1038
}
1032
1039
You can’t perform that action at this time.
0 commit comments