Skip to content

Commit f6db1cb

Browse files
committed
Extend Microsoft SQL Server detection
Update Microsoft SQL Server detection logic to retain "SQL SERVER" support (just in case the server string is driver specific). See gh-8222
1 parent 99683df commit f6db1cb

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,16 @@ public enum DatabaseDriver {
101101
* SQL Server.
102102
*/
103103
SQLSERVER("Microsoft SQL Server", "com.microsoft.sqlserver.jdbc.SQLServerDriver",
104-
"com.microsoft.sqlserver.jdbc.SQLServerXADataSource", "SELECT 1"),
104+
"com.microsoft.sqlserver.jdbc.SQLServerXADataSource", "SELECT 1") {
105+
106+
@Override
107+
protected boolean matchProductName(String productName) {
108+
return super.matchProductName(productName)
109+
|| "SQL SERVER".equalsIgnoreCase(productName);
110+
111+
}
112+
113+
},
105114

106115
/**
107116
* Firebird.

spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ public void databaseProductNameLookups() throws Exception {
8686
.isEqualTo(DatabaseDriver.POSTGRESQL);
8787
assertThat(DatabaseDriver.fromProductName("Microsoft SQL Server"))
8888
.isEqualTo(DatabaseDriver.SQLSERVER);
89+
assertThat(DatabaseDriver.fromProductName("SQL SERVER"))
90+
.isEqualTo(DatabaseDriver.SQLSERVER);
8991
assertThat(DatabaseDriver.fromProductName("DB2")).isEqualTo(DatabaseDriver.DB2);
9092
assertThat(DatabaseDriver.fromProductName("Firebird 2.5.WI"))
9193
.isEqualTo(DatabaseDriver.FIREBIRD);

0 commit comments

Comments
 (0)