Skip to content

Commit 027573f

Browse files
committed
Add support for kingabse
Signed-off-by: zbw1231 <[email protected]>
1 parent f7bb14f commit 027573f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

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

+9-1
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,16 @@ public enum DatabaseDriver {
8585

8686
/**
8787
* Kingbase.
88+
* @since 3.4.0
8889
*/
89-
KINGBASE("KingbaseES","com.kingbase8.Driver","com.kingbase8.xa.KBXADataSource","SELECT 1"),
90+
KINGBASE("KingbaseES","com.kingbase8.Driver","com.kingbase8.xa.KBXADataSource","SELECT 1") {
91+
92+
@Override
93+
protected Collection<String> getUrlPrefixes() {
94+
return Collections.singleton("kingbase8");
95+
}
96+
97+
},
9098

9199
/**
92100
* Amazon Redshift.

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

+3
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ void databaseProductNameLookups() {
7272
assertThat(DatabaseDriver.fromProductName("MariaDB")).isEqualTo(DatabaseDriver.MARIADB);
7373
assertThat(DatabaseDriver.fromProductName("Oracle")).isEqualTo(DatabaseDriver.ORACLE);
7474
assertThat(DatabaseDriver.fromProductName("PostgreSQL")).isEqualTo(DatabaseDriver.POSTGRESQL);
75+
assertThat(DatabaseDriver.fromProductName("KingbaseES")).isEqualTo(DatabaseDriver.KingbaseES);
7576
assertThat(DatabaseDriver.fromProductName("Redshift")).isEqualTo(DatabaseDriver.REDSHIFT);
7677
assertThat(DatabaseDriver.fromProductName("Microsoft SQL Server")).isEqualTo(DatabaseDriver.SQLSERVER);
7778
assertThat(DatabaseDriver.fromProductName("SQL SERVER")).isEqualTo(DatabaseDriver.SQLSERVER);
@@ -99,6 +100,8 @@ void databaseJdbcUrlLookups() {
99100
.isEqualTo(DatabaseDriver.ORACLE);
100101
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:postgresql://127.0.0.1:5432/sample"))
101102
.isEqualTo(DatabaseDriver.POSTGRESQL);
103+
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:kingbase8://localhost:54321/test"))
104+
.isEqualTo(DatabaseDriver.POSTGRESQL);
102105
assertThat(DatabaseDriver
103106
.fromJdbcUrl("jdbc:redshift://examplecluster.abc123xyz789.us-west-2.redshift.amazonaws.com:5439/sample"))
104107
.isEqualTo(DatabaseDriver.REDSHIFT);

0 commit comments

Comments
 (0)