I am using following configuration in application.ini for database;
resources.db.adapter = "Mysqli"
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = "root"
resources.db.params.dbname = "dbname"
resources.db.params.charset = "utf8"
After that using standard Model/Mapper/DbTable classes to access database like this
Now I want to access some other database but with same table structure as local database. How can I switch my database for that specific controller/action where I want to show data for other database.
Thanks.
You can use Zend_Application_Resource_Multidb
There is an example of its usage here, under the heading
Different user/host.Similar question(s) on Stackoverflow
EDIT: I also discovered that even when I had the following lines in my Model inherited from
Zend_Db_Table_Abstractit was not connecting to the remote DB.So I checked this function in Zend_Db_Table_Abstract
If its the same for you, add the following lines to your constructor: