Skip to content

Commit

Permalink
Move Retry block to Exception handler
Browse files Browse the repository at this point in the history
  • Loading branch information
cheenamalhotra committed Apr 17, 2019
1 parent 3fd3e60 commit 6cc07a8
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* The API javadoc for JDBC API methods that this class implements are not repeated here. Please see Sun's JDBC API
* interfaces javadoc for those details.
*/
@SuppressWarnings("unused")
public final class SQLServerDatabaseMetaData implements java.sql.DatabaseMetaData, Serializable {
/**
* Always update serialVersionUID when prompted.
Expand Down Expand Up @@ -1014,19 +1015,25 @@ public int getMaxColumnsInTable() throws SQLServerException {
@Override
public int getMaxConnections() throws SQLException, SQLTimeoutException {
checkClosed();
SQLServerResultSet rs = null;
try {
SQLServerResultSet rs = getResultSetFromInternalQueries(null,
rs = getResultSetFromInternalQueries(null,
"select maximum from sys.configurations where name = 'user connections'");
if (!rs.next()) {
// Try with sp_configure if users do not have privileges to execute sys.configurations
return 0;
}
return rs.getInt("maximum");
} catch (SQLServerException e) {
// Try with sp_configure if users do not have privileges to execute sys.configurations
try {
rs = getResultSetFromInternalQueries(null, "sp_configure 'user connections'");
if (!rs.next()) {
return 0;
}
return rs.getInt("maximum");
} catch (SQLServerException e1) {
return 0;
}
return rs.getInt("maximum");
} catch (SQLServerException e) {
return 0;
}
}

Expand Down

0 comments on commit 6cc07a8

Please sign in to comment.