Fix DSN detection in the IBM DB2 driver

parent 3745877c
......@@ -4,6 +4,8 @@ namespace Doctrine\DBAL\Driver\IBMDB2;
use Doctrine\DBAL\Driver\AbstractDB2Driver;
use function strpos;
/**
* IBM DB2 Driver.
*/
......@@ -18,7 +20,7 @@ class DB2Driver extends AbstractDB2Driver
$params['protocol'] = 'TCPIP';
}
if ($params['host'] !== 'localhost' && $params['host'] !== '127.0.0.1') {
if (strpos($params['dbname'], '=') === false) {
// if the host isn't localhost, use extended connection params
$params['dbname'] = 'DRIVER={IBM DB2 ODBC DRIVER}' .
';DATABASE=' . $params['dbname'] .
......
......@@ -14,7 +14,7 @@
<var name="db_host" value="127.0.0.1"/>
<var name="db_user" value="db2inst1"/>
<var name="db_password" value="Doctrine2018"/>
<var name="db_dbname" value="HOSTNAME=127.0.0.1;UID=db2inst1;PWD=Doctrine2018;DATABASE=doctrine"/>
<var name="db_dbname" value="doctrine"/>
</php>
<testsuites>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment