Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…col and port values.
  • Loading branch information...
commit 999fc5be2ee8834a1c612d48f08a2aff3ec5aa6f 1 parent a0cb862
@beberlei beberlei authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php
View
9 lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php
@@ -41,8 +41,8 @@ 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') {
@@ -50,10 +50,13 @@ public function connect(array $params, $username = null, $password = null, array
$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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.