Try to use:
$db_config['adapter'] = 'PDO_PGSQL';
$db_config['host'] = 'localhost';
$db_config['port'] = '5432';
$db_config['username'] = 'root';
$db_config['password'] = 'root';
$db_config['dbname'] = 'certilogo';
$adapter = $db_config['adapter'];
unset($db_config['adapter']);
$db = Zend_Db::factory($adapter,$db_config);
Best Regards,
Luiz Fernando
----- Mensagem original ----
De: amar4kintu <amar.kintu@gmail.com>
Para: fw-db@lists.zend.com
Enviadas: Segunda-feira, 10 de Novembro de 2008 10:14:18
Assunto: [fw-db] Need help with postgresql using Zend frame work
Hello
I am using zend framework with postgresql to develop my site.
I am using WAMP on windows server 2003 with apache 2.2.8 and php 5.2.6.
I have enabled pdo_pgsql extension for php so as to work with postgresql.
I am using following for connection in zend framework
$db_config['adapter'] = 'PDO_PGSQL';
$db_config['host'] = 'localhost';
$db_config['port'] = '5432';
$db_config['username'] = 'root';
$db_config['password'] = 'root';
$db_config['dbname'] = 'certilogo';
$db = Zend_Db::factory($db_config['adapter'],$db_config);
Zend_Db_Table::setDefaultAdapter($db);
but when I try to execute qurey as below
$sql = 'SELECT * FROM admin_master';
$result = $db->fetchAll($sql);
It gives following error
Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message
'SQLSTATE[08006] [7] invalid connection option "adapter"' in
E:\websites\certilogo\library\Zend\Db\Adapter\Pdo\Abstract.php:143 Stack
trace: #0 E:\websites\certilogo\library\Zend\Db\Adapter\Abstract.php(414):
Zend_Db_Adapter_Pdo_Abstract->_connect() #1
E:\websites\certilogo\library\Zend\Db\Adapter\Pdo\Abstract.php(220):
Zend_Db_Adapter_Abstract->query('SELECT * FROM a...', Array) #2
E:\websites\certilogo\library\Zend\Db\Adapter\Abstract.php(641):
Zend_Db_Adapter_Pdo_Abstract->query('SELECT * FROM a...', Array) #3
E:\websites\certilogo\application\modules\admin\controllers\LoginController.php(22):
Zend_Db_Adapter_Abstract->fetchAll('SELECT * FROM a...') #4
E:\websites\certilogo\library\Zend\Controller\Action.php(494):
Admin_LoginController->indexAction() #5
E:\websites\certilogo\library\Zend\Controller\Dispatcher\Standard.php(285):
Zend_Controller_Action->dispatch('indexAction') #6
E:\websites\certilogo\library\Zend\Controller\Front.php(934): Zend_Con in
E:\websites\certilogo\library\Zend\Db\Adapter\Pdo\Abstract.php on line 143
Can any one please help me what the problem is?
Thanks
--
View this message in context: http://www.nabble.com/Need-help-with-postgresql-using-Zend-frame-work-tp20418829p20418829.html
Sent from the Zend DB mailing list archive at Nabble.com.
Novos endereços, o Yahoo! que você conhece. Crie um email novo com a sua cara @ymail.com ou @rocketmail.com.
http://br.new.mail.yahoo.com/addresses
没有评论:
发表评论