From 3e743a8799d5720c19e23c9e5e56eec42103ca29 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 11 Jul 2017 17:15:25 +0200 Subject: [PATCH] DbConnection: Fix "Driver does not support setting attributes" for the pdolib extension fixes #12640 --- library/Icinga/Data/Db/DbConnection.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Data/Db/DbConnection.php b/library/Icinga/Data/Db/DbConnection.php index 15a249f60..0c5b44597 100644 --- a/library/Icinga/Data/Db/DbConnection.php +++ b/library/Icinga/Data/Db/DbConnection.php @@ -139,7 +139,14 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp switch ($this->dbType) { case 'mssql': $adapter = 'Pdo_Mssql'; - $adapterParamaters['pdoType'] = $this->config->get('pdoType', 'dblib'); + $pdoType = $this->config->get('pdoType', 'dblib'); + if ($pdoType === 'dblib') { + // Driver does not support setting attributes + unset($adapterParamaters['persistent']); + unset($adapterParamaters['options']); + unset($adapterParamaters['driver_options']); + } + $adapterParamaters['pdoType'] = $pdoType; $defaultPort = 1433; break; case 'mysql':