Navigation Menu

Skip to content

Commit

Permalink
0005710: When connecting to Azure, set platform version to SQL Server
Browse files Browse the repository at this point in the history
2016
  • Loading branch information
Philip Marzullo committed Feb 27, 2023
1 parent 0c12862 commit 00e0991
Showing 1 changed file with 19 additions and 0 deletions.
Expand Up @@ -310,6 +310,25 @@ protected void determineDatabaseNameVersionSubprotocol(DataSource dataSource, Co
}
}
}
if (nameVersion.getProtocol().equalsIgnoreCase("sqlserver")) {
int engineEdition = getMsSqlEngineEdition(connection);
if (engineEdition >= 5) {
nameVersion.setName(DatabaseNamesConstants.MSSQL2016);
}
}
}

private static int getMsSqlEngineEdition(Connection connection) {
int engineEdition = -1;
try (Statement s = connection.createStatement()) {
ResultSet rs = s.executeQuery("SELECT CAST(SERVERPROPERTY('EngineEdition') AS INT)");
if (rs.next()) {
engineEdition = rs.getInt(1);
}
} catch (SQLException e) {
log.info("Unable to get Sql Server Engine Edition");
}
return engineEdition;
}

private boolean isGreenplumDatabase(Connection connection) {
Expand Down

0 comments on commit 00e0991

Please sign in to comment.