diff --git a/application/forms/Config/Resource/DbResourceForm.php b/application/forms/Config/Resource/DbResourceForm.php index 0bd0c6560..89fe75f15 100644 --- a/application/forms/Config/Resource/DbResourceForm.php +++ b/application/forms/Config/Resource/DbResourceForm.php @@ -36,6 +36,9 @@ class DbResourceForm extends Form if (Platform::hasMssqlSupport()) { $dbChoices['mssql'] = 'MSSQL'; } + if (Platform::hasIbmSupport()) { + $dbChoices['ibm'] = 'IBM (DB2)'; + } if (Platform::hasOracleSupport()) { $dbChoices['oracle'] = 'Oracle'; } @@ -45,6 +48,7 @@ class DbResourceForm extends Form $offerSsl = false; $offerPostgres = false; + $offerIbm = false; $offerMysql = false; $dbChoice = isset($formData['db']) ? $formData['db'] : key($dbChoices); if ($dbChoice === 'pgsql') { @@ -54,6 +58,8 @@ class DbResourceForm extends Form if (version_compare(Platform::getPhpVersion(), '5.4.0', '>=')) { $offerSsl = true; } + } elseif ($dbChoice === 'ibm') { + $offerIbm = true; } $socketInfo = ''; diff --git a/library/Icinga/Application/Platform.php b/library/Icinga/Application/Platform.php index 127e655ae..21ef47d52 100644 --- a/library/Icinga/Application/Platform.php +++ b/library/Icinga/Application/Platform.php @@ -366,6 +366,18 @@ class Platform return static::extensionLoaded('pdo_mysql') && static::classExists('Zend_Db_Adapter_Pdo_Mysql'); } + /** + * Return whether it's possible to connect to a IBM DB2 database + * + * Checks whether the ibm pdo extension has been loaded and the Zend framework adapter for IBM is available + * + * @return bool + */ + public static function hasIbmSupport() + { + return static::extensionLoaded('pdo_ibm') && static::classExists('Zend_Db_Adapter_Pdo_Ibm'); + } + /** * Return whether it's possible to connect to a Oracle database using OCI8 * diff --git a/library/Icinga/Data/Db/DbConnection.php b/library/Icinga/Data/Db/DbConnection.php index 0c5b44597..a52ffc388 100644 --- a/library/Icinga/Data/Db/DbConnection.php +++ b/library/Icinga/Data/Db/DbConnection.php @@ -203,6 +203,10 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp $adapter = 'Pdo_Pgsql'; $defaultPort = 5432; break; + case 'ibm': + $adapter = 'Pdo_Ibm'; + $defaultPort = 50000; + break; default: throw new ConfigurationError( 'Backend "%s" is not supported',