ZF-9131: Exception thrown when Zend_Application_Resource_Multidb used with pdo_pgsql adapter

Issue Type: Bug Created: 2010-02-10T02:15:24.000+0000 Last Updated: 2010-05-22T15:49:35.000+0000 Status: Resolved Fix version(s): - 1.10.5 (26/May/10)

Reporter: Maarten Oudega (moudega) Assignee: David Abdemoulaie (hobodave) Tags: - Zend_Application_Resource

Related issues: Attachments: - Multidb.patch


When configuring Zend_Application_Resource_Multidb to use a pdo_pgsql adapter as per example in the Programmer's Reference Guide, Zend_Db_Adapter_Pdo_Abstract throws an Zend_Db_Adapter_Exception with the message: SQLSTATE[08006] [7] invalid connection option "adapter"

I based my code on this example:…

The following configuration lines were used:

resources.multidb.db1.adapter = "pdo_pgsql" = "localhost" resources.multidb.db1.port = 8000 resources.multidb.db1.username = "myUsername" resources.multidb.db1.password = "myPassword" resources.multidb.db1.dbname = "myDb"

This problem could be solved if the configuration of Zend_Application_Resource_Multidb would be more similar to Zend_Application_Resource_Db and connection parameters are stored in an array called params. E.g.:

resources.multidb.db1.adapter = "pdo_pgsql" = "localhost" resources.multidb.db1.params.port = 8000 resources.multidb.db1.params.username = "myUsername" resources.multidb.db1.params.password = "myPassword" resources.multidb.db1.params.dbname = "myDb"

To maintain backwards compatibility, the following change could be made to Zend_Application_Resource_Multidb and replace line 81:

$this->_dbs[$id] = Zend_Db::factory($params['adapter'], $params);

with the following:

if (isset($params['params'])) { $this->_dbs[$id] = Zend_Db::factory($params['adapter'], $params['params']); } else { $this->_dbs[$id] = Zend_Db::factory($params['adapter'], $params); }


Posted by Dolf Schimmel (Freeaqingme) (freak) on 2010-02-10T02:38:24.000+0000

Thank you for reporting this issue. Will evaluate if this should be solved in Zend_Db or in Zend_App.

Posted by Ralph Schindler (ralph) on 2010-02-10T10:39:23.000+0000

This should be solved in Zend_Application_Resource_Multidb. In fact, the adapter should have been built to accept config objects in the same format as the db adapter with a params key, as noted above. That should be the fix.

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2010-02-10T16:37:23.000+0000

Resolved with r21013. Thank you for reporting the issue.

Posted by Ramon Henrique Ornelas (ramon) on 2010-02-16T15:09:14.000+0000

Problem with the option

<pre class="highlight">
resources.multidb.db1.isDefaultTableAdapter = 1

Exception: Zend_Db_Adapter_Exception: SQLSTATE[08006] [7] invalid connection option "isDefaultTableAdapter"

Dsn connection Pdo: 'pgsql:host=localhost;dbname=zf_test;isDefaultTableAdapter=1'

Posted by Ramon Henrique Ornelas (ramon) on 2010-02-16T17:44:08.000+0000

Attached patch

Posted by Ramon Henrique Ornelas (ramon) on 2010-02-19T13:11:15.000+0000

Ignore the first patch no contains test unit.

See the patch Multidb2.patch.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.