Permalink
Browse files

[DBAL-201] Fixed IBM DB2 Driver not allowing default values for proto…

…col and port values.
  • Loading branch information...
beberlei committed Jan 21, 2012
1 parent a0cb862 commit 999fc5be2ee8834a1c612d48f08a2aff3ec5aa6f
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php
@@ -41,19 +41,22 @@ class DB2Driver implements Driver
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{
- if ( !isset($params['schema']) ) {
-
+ if ( ! isset($params['protocol'])) {
+ $params['protocol'] = 'TCPIP';
}
if ($params['host'] !== 'localhost' && $params['host'] != '127.0.0.1') {
// if the host isn't localhost, use extended connection params
$params['dbname'] = 'DRIVER={IBM DB2 ODBC DRIVER}' .
';DATABASE=' . $params['dbname'] .
';HOSTNAME=' . $params['host'] .
- ';PORT=' . $params['port'] .
';PROTOCOL=' . $params['protocol'] .
';UID=' . $username .
';PWD=' . $password .';';
+ if (isset($params['port'])) {
+ $params['dbname'] .= 'PORT=' . $params['port'];
+ }
+
$username = null;
$password = null;
}

0 comments on commit 999fc5b

Please sign in to comment.