Db autodiscovery for DB2 does not work on all installations of DB2

Description

We are playing around with DB2 support in Activiti 5.3. There is a problem with DB2 9.72 Express Version on Windows x64. The database name is not identified correctly. DB2 is special here, so additional database type mappings are needed. Every different DB2 version has its own product name. We found the problematic code in class ProcessEngineConfigurationImpl and method getDefaultDatabaseTypeMappings().

Please add the following type mappings. These mappings are used in IBM WebSphere Application Server 7.0:

databaseTypeMappings.setProperty("DB2","db2");
databaseTypeMappings.setProperty("DB2/NT","db2");
databaseTypeMappings.setProperty("DB2/NT64","db2");
databaseTypeMappings.setProperty("DB2 UDP","db2");
databaseTypeMappings.setProperty("DB2/LINUX","db2");
databaseTypeMappings.setProperty("DB2/LINUX390","db2");
databaseTypeMappings.setProperty("DB2/400 SQL","db2");
databaseTypeMappings.setProperty("DB2/6000","db2");
databaseTypeMappings.setProperty("DB2 UDB iSeries","db2");
databaseTypeMappings.setProperty("DB2/AIX64","db2");
databaseTypeMappings.setProperty("DB2/HPUX","db2");
databaseTypeMappings.setProperty("DB2/HP64","db2");
databaseTypeMappings.setProperty("DB2/SUN","db2");
databaseTypeMappings.setProperty("DB2/SUN64","db2");
databaseTypeMappings.setProperty("DB2/PTX","db2");
databaseTypeMappings.setProperty("DB2/2","db2");

If you don't want to add all these mapping, use sample code below. We use that code in our application:

if(databaseMetaData.getDatabaseProductName().startsWith("DB2"))
{
// is DB2 database
}

Environment

None

Assignee

Joram Barrez

Reporter

Joram Barrez

Labels

None

Fix versions

Priority

Minor
Configure