Skip to content

Commit 4ad2f1d

Browse files
committed
Merge pull request #14513 from MichaelSp:patch-1
* pr/14513: Polish "Add support for SAP Hana Database" Add support for SAP Hana Database
2 parents cd45343 + 22e77e0 commit 4ad2f1d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ public String getId() {
9999
POSTGRESQL("PostgreSQL", "org.postgresql.Driver", "org.postgresql.xa.PGXADataSource",
100100
"SELECT 1"),
101101

102+
/**
103+
* SAP - SAP Hana Database - HDB.
104+
*/
105+
SAP("HDB", "com.sap.db.jdbc.Driver", "com.sap.db.jdbcext.XADataSourceSAP",
106+
"SELECT 1 FROM DUMMY"),
107+
102108
/**
103109
* jTDS. As it can be used for several databases, there isn't a single product name we
104110
* could rely on.

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -74,6 +74,7 @@ public void databaseProductNameLookups() {
7474
assertThat(DatabaseDriver.fromProductName("Apache Derby"))
7575
.isEqualTo(DatabaseDriver.DERBY);
7676
assertThat(DatabaseDriver.fromProductName("H2")).isEqualTo(DatabaseDriver.H2);
77+
assertThat(DatabaseDriver.fromProductName("HDB")).isEqualTo(DatabaseDriver.SAP);
7778
assertThat(DatabaseDriver.fromProductName("HSQL Database Engine"))
7879
.isEqualTo(DatabaseDriver.HSQLDB);
7980
assertThat(DatabaseDriver.fromProductName("SQLite"))
@@ -126,6 +127,8 @@ public void databaseJdbcUrlLookups() {
126127
assertThat(
127128
DatabaseDriver.fromJdbcUrl("jdbc:jtds:sqlserver://127.0.0.1:1433/sample"))
128129
.isEqualTo(DatabaseDriver.JTDS);
130+
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:sap:localhost"))
131+
.isEqualTo(DatabaseDriver.SAP);
129132
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:sqlserver://127.0.0.1:1433"))
130133
.isEqualTo(DatabaseDriver.SQLSERVER);
131134
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:firebirdsql://localhost/sample"))

0 commit comments

Comments
 (0)