Merge pull request #14513 from MichaelSp:patch-1

* pr/14513:
  Polish "Add support for SAP Hana Database"
  Add support for SAP Hana Database
This commit is contained in:
Stephane Nicoll
2018-09-20 12:03:33 +02:00
2 changed files with 10 additions and 1 deletions

View File

@@ -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.

View File

@@ -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"))