diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java index 367f0dcd30..d17e1b47c4 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java @@ -99,6 +99,12 @@ public enum DatabaseDriver { POSTGRESQL("PostgreSQL", "org.postgresql.Driver", "org.postgresql.xa.PGXADataSource", "SELECT 1"), + /** + * SAP - SAP Hana Database - HDB. + */ + SAP("HDB", "com.sap.db.jdbc.Driver", "com.sap.db.jdbcext.XADataSourceSAP", + "SELECT 1 FROM DUMMY"), + /** * jTDS. As it can be used for several databases, there isn't a single product name we * could rely on. diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java index 0396a75b88..edd85a708b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,6 +74,7 @@ public class DatabaseDriverTests { assertThat(DatabaseDriver.fromProductName("Apache Derby")) .isEqualTo(DatabaseDriver.DERBY); assertThat(DatabaseDriver.fromProductName("H2")).isEqualTo(DatabaseDriver.H2); + assertThat(DatabaseDriver.fromProductName("HDB")).isEqualTo(DatabaseDriver.SAP); assertThat(DatabaseDriver.fromProductName("HSQL Database Engine")) .isEqualTo(DatabaseDriver.HSQLDB); assertThat(DatabaseDriver.fromProductName("SQLite")) @@ -126,6 +127,8 @@ public class DatabaseDriverTests { assertThat( DatabaseDriver.fromJdbcUrl("jdbc:jtds:sqlserver://127.0.0.1:1433/sample")) .isEqualTo(DatabaseDriver.JTDS); + assertThat(DatabaseDriver.fromJdbcUrl("jdbc:sap:localhost")) + .isEqualTo(DatabaseDriver.SAP); assertThat(DatabaseDriver.fromJdbcUrl("jdbc:sqlserver://127.0.0.1:1433")) .isEqualTo(DatabaseDriver.SQLSERVER); assertThat(DatabaseDriver.fromJdbcUrl("jdbc:firebirdsql://localhost/sample"))