I had been performing sql query in zend something similar to this also it was working:

$front = Zend_Controller_Front::getInstance();
$bootstrap = $front->getParam('bootstrap');
$resource = $bootstrap->getPluginResource('db');
$dbAdapter = $resource->getDbAdapter();
$statement = $dbAdapter->query("SELECT * from tablename");
$results = $statement->fetchAll();

In those days my application.ini was something similar to this:

resources.db.adapter = "Mysqli"
resources.db.params.host = "localhost"
resources.db.params.username = "username"
resources.db.params.password = "password"
resources.db.params.dbname = "dbname"

Question:

Now I transformed my application.ini to:

resources.multidb.local.adapter = "Mysqli"
resources.multidb.local.host = "localhost"
resources.multidb.local.username = "username"
resources.multidb.local.password = "passwod"
resources.multidb.local.dbname = "dbname"
resources.multidb.local.default = true

Now above zend code is creating following error:

Fatal error: Call to a member function getDbAdapter() on a non-object in Mapper.php  on line 297

How you can fix my code based on new application.ini configurations ?

Thanks

To retrieve the default Database Adapter make use of the following code:

$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
$resource = $bootstrap->getPluginResource('multidb');
$db = $resource->getDb();

Following code is employed by me with multidb configuration in application.ini

$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
$resource = $bootstrap->getPluginResource('multidb');
$db = $resource->getDb();
$statement = $db->query("SELECT * from tablename");
$results = $statement->fetchAll();