From 146f35d2bd9c1a81f1eb1bfdcd1472aa72f22022 Mon Sep 17 00:00:00 2001 From: Henryk Konsek Date: Mon, 13 May 2019 16:06:01 +0200 Subject: [PATCH 1/2] Add support for AWS Redshift JDBC driver See gh-16831 --- .../java/org/springframework/boot/jdbc/DatabaseDriver.java | 5 +++++ .../org/springframework/boot/jdbc/DatabaseDriverTests.java | 5 +++++ 2 files changed, 10 insertions(+) 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 cf94a912ab..f16cf61a40 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,11 @@ public enum DatabaseDriver { POSTGRESQL("PostgreSQL", "org.postgresql.Driver", "org.postgresql.xa.PGXADataSource", "SELECT 1"), + /** + * AWS Redshift. + */ + REDSHIFT("Amazon Redshift", "com.amazon.redshift.jdbc.Driver", null, "SELECT 1"), + /** * HANA - SAP HANA Database - HDB. * @since 2.1.0 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 da1067b6d8..ebb62d940d 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 @@ -81,6 +81,8 @@ public class DatabaseDriverTests { .isEqualTo(DatabaseDriver.ORACLE); assertThat(DatabaseDriver.fromProductName("PostgreSQL")) .isEqualTo(DatabaseDriver.POSTGRESQL); + assertThat(DatabaseDriver.fromProductName("Amazon Redshift")) + .isEqualTo(DatabaseDriver.REDSHIFT); assertThat(DatabaseDriver.fromProductName("Microsoft SQL Server")) .isEqualTo(DatabaseDriver.SQLSERVER); assertThat(DatabaseDriver.fromProductName("SQL SERVER")) @@ -120,6 +122,9 @@ public class DatabaseDriverTests { .isEqualTo(DatabaseDriver.ORACLE); assertThat(DatabaseDriver.fromJdbcUrl("jdbc:postgresql://127.0.0.1:5432/sample")) .isEqualTo(DatabaseDriver.POSTGRESQL); + assertThat(DatabaseDriver.fromJdbcUrl( + "jdbc:redshift://foo.bar.us-east-1.redshift.amazonaws.com:5439/postgres")) + .isEqualTo(DatabaseDriver.REDSHIFT); assertThat( DatabaseDriver.fromJdbcUrl("jdbc:jtds:sqlserver://127.0.0.1:1433/sample")) .isEqualTo(DatabaseDriver.JTDS); From 9e31c764fc91f58ab5d8eabc96658ef629a93b84 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 20 May 2019 14:22:56 +0200 Subject: [PATCH 2/2] Polish "Add support for AWS Redshift JDBC driver" Closes gh-16831 --- .../java/org/springframework/boot/jdbc/DatabaseDriver.java | 3 ++- .../org/springframework/boot/jdbc/DatabaseDriverTests.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) 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 f16cf61a40..787a78a0d1 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 @@ -100,7 +100,8 @@ public enum DatabaseDriver { "SELECT 1"), /** - * AWS Redshift. + * Amazon Redshift. + * @since 2.2.0 */ REDSHIFT("Amazon Redshift", "com.amazon.redshift.jdbc.Driver", null, "SELECT 1"), 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 ebb62d940d..a9697d54bd 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 @@ -123,7 +123,7 @@ public class DatabaseDriverTests { assertThat(DatabaseDriver.fromJdbcUrl("jdbc:postgresql://127.0.0.1:5432/sample")) .isEqualTo(DatabaseDriver.POSTGRESQL); assertThat(DatabaseDriver.fromJdbcUrl( - "jdbc:redshift://foo.bar.us-east-1.redshift.amazonaws.com:5439/postgres")) + "jdbc:redshift://examplecluster.abc123xyz789.us-west-2.redshift.amazonaws.com:5439/sample")) .isEqualTo(DatabaseDriver.REDSHIFT); assertThat( DatabaseDriver.fromJdbcUrl("jdbc:jtds:sqlserver://127.0.0.1:1433/sample"))