Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect Kingbase JDBC driver #44710

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=3.5.0-SNAPSHOT
version=3.4.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert.

latestVersion=true
spring.build-type=oss

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,19 @@ public enum DatabaseDriver {
*/
POSTGRESQL("PostgreSQL", "org.postgresql.Driver", "org.postgresql.xa.PGXADataSource", "SELECT 1"),

/**
* Kingbase.
* @since 3.4.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@since 3.5.0

*/
KINGBASE("KingbaseES","com.kingbase8.Driver","com.kingbase8.xa.KBXADataSource","SELECT 1") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still an issue with the formatting. Please refer to the Spring Boot Contributing Guidelines.

Please use ./gradlew format to reformat your code.


@Override
protected Collection<String> getUrlPrefixes() {
return Collections.singleton("kingbase8");
}

},

/**
* Amazon Redshift.
* @since 2.2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ void databaseProductNameLookups() {
assertThat(DatabaseDriver.fromProductName("MariaDB")).isEqualTo(DatabaseDriver.MARIADB);
assertThat(DatabaseDriver.fromProductName("Oracle")).isEqualTo(DatabaseDriver.ORACLE);
assertThat(DatabaseDriver.fromProductName("PostgreSQL")).isEqualTo(DatabaseDriver.POSTGRESQL);
assertThat(DatabaseDriver.fromProductName("KingbaseES")).isEqualTo(DatabaseDriver.KingbaseES);
Copy link
Contributor

@nosan nosan Mar 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compile error:

/Users/dmytronosan/IdeaProjects/spring-boot/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java:75: error: cannot find symbol
assertThat(DatabaseDriver.fromProductName("KingbaseES")).isEqualTo(DatabaseDriver.KingbaseES);
^
symbol: variable KingbaseES
location: class DatabaseDriver

Please run ./gradlew build to ensure that your changes do not break the build.

assertThat(DatabaseDriver.fromProductName("Redshift")).isEqualTo(DatabaseDriver.REDSHIFT);
assertThat(DatabaseDriver.fromProductName("Microsoft SQL Server")).isEqualTo(DatabaseDriver.SQLSERVER);
assertThat(DatabaseDriver.fromProductName("SQL SERVER")).isEqualTo(DatabaseDriver.SQLSERVER);
Expand Down Expand Up @@ -99,6 +100,8 @@ void databaseJdbcUrlLookups() {
.isEqualTo(DatabaseDriver.ORACLE);
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:postgresql://127.0.0.1:5432/sample"))
.isEqualTo(DatabaseDriver.POSTGRESQL);
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:kingbase8://localhost:54321/test"))
Copy link
Contributor

@nosan nosan Mar 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test fails.

Please run ./gradlew build to verify your changes

.isEqualTo(DatabaseDriver.POSTGRESQL);
assertThat(DatabaseDriver
.fromJdbcUrl("jdbc:redshift://examplecluster.abc123xyz789.us-west-2.redshift.amazonaws.com:5439/sample"))
.isEqualTo(DatabaseDriver.REDSHIFT);
Expand Down