我是Zend的新手。 我正在使用Zend 1.11并尝试成功连接到Firebird数据库。 据我所知,我已经启用了所有的php_interbase内容。 我看到ZendX firebird适配器,但我仍然收到此消息
警告:include_once(Zend \ Db \ Adapter \ Php \ Firebird.php)[function.include-once]:无法打开流:C:\ wamp \ bin \ php \ Zend_Framework \ library \ Zend \中没有这样的文件或目录第146行的Loader.php
好像它不知道我在说什么适配器。
我在我的靴带里使用它
protected function _initDb() { $this->bootstrap('config'); $config = $this->getResource('config'); $db = Zend_Db::factory('Php_Firebird', array( 'host' => $config->Database->Server, 'username' => $config->Database->Username, 'password' => $config->Database->Password, 'dbname' => $config->Database->DBName )); return $db; }我假设这与事实有关,这是ZendX的东西,而不是Zend \ db的东西,但我找不到它的一个例子。 或者使用ZendX适配器从工厂功能。 我试图使用'Php_Interbase',但是也找不到(而且我还没有在文件夹中看到它)。 我也试过了Pdo_Firebird,当然也没用。
有人这样做可以指出我做错了吗?
谢谢
I am new to Zend. I'm using Zend 1.11 and trying to successfully connect to a Firebird database. As far as I can tell I have all the php_interbase stuff enabled. I see the ZendX firebird adapter, but I still get this message
Warning: include_once(Zend\Db\Adapter\Php\Firebird.php) [function.include-once]: failed to open stream: No such file or directory in C:\wamp\bin\php\Zend_Framework\library\Zend\Loader.php on line 146
As if it has no idea what adapter I'm speaking of.
I'm using this in my boot strap
protected function _initDb() { $this->bootstrap('config'); $config = $this->getResource('config'); $db = Zend_Db::factory('Php_Firebird', array( 'host' => $config->Database->Server, 'username' => $config->Database->Username, 'password' => $config->Database->Password, 'dbname' => $config->Database->DBName )); return $db; }I'm assuming this has something to do with the fact this is ZendX stuff not Zend\db stuff but I cannot find an example of it. Or from the factory function using a ZendX adapter. I tried to use 'Php_Interbase' but that was not found either (and I dont see it in the folders anyway). And I tried Pdo_Firebird as well which of course didnt work.
Has someone done this that can point me to what I'm doing wrong?
Thanks
最满意答案
您只需将adapterNamespace添加到要传递给工厂的配置数组中。 请参阅此处的第3个示例 ,同时从适配器名称中删除'PHP_' ,因此您对工厂的调用应如下所示: -
$db = Zend_Db::factory('Firebird', array( 'host' => $config->Database->Server, 'username' => $config->Database->Username, 'password' => $config->Database->Password, 'dbname' => $config->Database->DBName, 'adapterNamespace' => 'ZendX_Db_Adapter' ));You just need to add adapterNamespace to the configuration array you are passing to the factory. See the 3rd example here, also remove 'PHP_' from the adapter name, so your call to the factory should look like this:-
$db = Zend_Db::factory('Firebird', array( 'host' => $config->Database->Server, 'username' => $config->Database->Username, 'password' => $config->Database->Password, 'dbname' => $config->Database->DBName, 'adapterNamespace' => 'ZendX_Db_Adapter' ));更多推荐
发布评论