Add DatabaseType POSTGRES for the product name EnterpriseDB
sheelprabhakar opened this issue · 0 comments
sheelprabhakar commented
In version 5.1.1, getting an exception for PostGres Enterprise Database version (EDB JDBC Connector), when using com.edb.Driver for connection
java.lang.IllegalArgumentException: DatabaseType not found for product name: [EnterpriseDB]
A possible solution can be by adding one condition in the method fromMetaData of class DatabaseType for EnterpriseDB
public static DatabaseType fromMetaData(DataSource dataSource) throws MetaDataAccessException {
String databaseProductName = (String) JdbcUtils.extractDatabaseMetaData(dataSource, DatabaseMetaData::getDatabaseProductName);
if (StringUtils.hasText(databaseProductName) && databaseProductName.startsWith("DB2")) {
String databaseProductVersion = (String)JdbcUtils.extractDatabaseMetaData(dataSource, DatabaseMetaData::getDatabaseProductVersion);
if (databaseProductVersion.startsWith("ARI")) {
databaseProductName = "DB2VSE";
} else if (databaseProductVersion.startsWith("DSN")) {
databaseProductName = "DB2ZOS";
} else if (!databaseProductName.contains("AS") || !databaseProductVersion.startsWith("QSQ") && !databaseProductVersion.substring(databaseProductVersion.indexOf(86)).matches("V\\dR\\d[mM]\\d")) {
databaseProductName = JdbcUtils.commonDatabaseName(databaseProductName);
} else {
databaseProductName = "DB2AS400";
}
}else if(StringUtils.hasText(databaseProductName) && databaseProductName.equals("EnterpriseDB")) {
databaseProductName = "PostgreSQL";
}else {
databaseProductName = JdbcUtils.commonDatabaseName(databaseProductName);
}
return fromProductName(databaseProductName);
}