Skip to content

Commit 127ff8c

Browse files
Sheel Prabhakarfmbenhassine
Sheel Prabhakar
authored andcommitted
Add DatabaseType POSTGRES for the product name EnterpriseDB
Resolves #4627
1 parent 8f7f37b commit 127ff8c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

spring-batch-infrastructure/src/main/java/org/springframework/batch/support/DatabaseType.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2023 the original author or authors.
2+
* Copyright 2006-2024 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.
@@ -103,6 +103,9 @@ else if (databaseProductName.contains("AS") && (databaseProductVersion.startsWit
103103
databaseProductName = JdbcUtils.commonDatabaseName(databaseProductName);
104104
}
105105
}
106+
else if (StringUtils.hasText(databaseProductName) && databaseProductName.startsWith("EnterpriseDB")) {
107+
databaseProductName = "PostgreSQL";
108+
}
106109
else {
107110
databaseProductName = JdbcUtils.commonDatabaseName(databaseProductName);
108111
}

spring-batch-infrastructure/src/test/java/org/springframework/batch/support/DatabaseTypeTests.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2008-2022 the original author or authors.
2+
* Copyright 2008-2024 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.
@@ -138,6 +138,12 @@ void testFromMetaDataForPostgres() throws Exception {
138138
assertEquals(POSTGRES, DatabaseType.fromMetaData(ds));
139139
}
140140

141+
@Test
142+
void testFromMetaDataForEnterpriseDB() throws Exception {
143+
DataSource ds = DatabaseTypeTestUtils.getMockDataSource("EnterpriseDB");
144+
assertEquals(POSTGRES, DatabaseType.fromMetaData(ds));
145+
}
146+
141147
@Test
142148
void testFromMetaDataForSybase() throws Exception {
143149
DataSource ds = DatabaseTypeTestUtils.getMockDataSource("Adaptive Server Enterprise");

0 commit comments

Comments
 (0)