Skip to content

Commit 2cabbed

Browse files
committed
Merge pull request #24114 from vpelikh
* pr/24114: Polish "Add Apache Phoenix to supported database drivers" Add Apache Phoenix to supported database drivers Closes gh-24114
2 parents eb14f06 + 83bdf19 commit 2cabbed

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

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

+6
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,12 @@ protected Collection<String> getUrlPrefixes() {
198198

199199
},
200200

201+
/**
202+
* Apache Phoenix.
203+
* @since 2.5.0
204+
*/
205+
PHOENIX("Apache Phoenix", "org.apache.phoenix.jdbc.PhoenixDriver", null, "SELECT 1 FROM SYSTEM.CATALOG LIMIT 1"),
206+
201207
/**
202208
* Testcontainers.
203209
*/

Diff for: spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverClassNameTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 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.
@@ -46,7 +46,7 @@ class DatabaseDriverClassNameTests {
4646

4747
private static final Set<DatabaseDriver> EXCLUDED_DRIVERS = Collections
4848
.unmodifiableSet(EnumSet.of(DatabaseDriver.UNKNOWN, DatabaseDriver.DB2_AS400, DatabaseDriver.INFORMIX,
49-
DatabaseDriver.HANA, DatabaseDriver.TERADATA, DatabaseDriver.REDSHIFT));
49+
DatabaseDriver.HANA, DatabaseDriver.PHOENIX, DatabaseDriver.TERADATA, DatabaseDriver.REDSHIFT));
5050

5151
@ParameterizedTest(name = "{0} {2}")
5252
@MethodSource

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 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.
@@ -82,6 +82,7 @@ void databaseProductNameLookups() {
8282
assertThat(DatabaseDriver.fromProductName("DB3 XDB for AS/400")).isEqualTo(DatabaseDriver.DB2_AS400);
8383
assertThat(DatabaseDriver.fromProductName("Teradata")).isEqualTo(DatabaseDriver.TERADATA);
8484
assertThat(DatabaseDriver.fromProductName("Informix Dynamic Server")).isEqualTo(DatabaseDriver.INFORMIX);
85+
assertThat(DatabaseDriver.fromProductName("Apache Phoenix")).isEqualTo(DatabaseDriver.PHOENIX);
8586
}
8687

8788
@Test
@@ -112,6 +113,7 @@ void databaseJdbcUrlLookups() {
112113
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:informix-sqli://localhost:1533/sample"))
113114
.isEqualTo(DatabaseDriver.INFORMIX);
114115
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:informix-direct://sample")).isEqualTo(DatabaseDriver.INFORMIX);
116+
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:phoenix:localhost")).isEqualTo(DatabaseDriver.PHOENIX);
115117
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:tc:mysql://localhost:3306/sample"))
116118
.isEqualTo(DatabaseDriver.TESTCONTAINERS);
117119
}

0 commit comments

Comments
 (0)