1. In App/etc/local.xml, add a new database option
<?xml version= "1.0"?> <config> <global> <install> < date><! [Cdata[tue, 03:23:52 +0000]]></date> </install> <crypt> <key><! [cdata[80eb4be66ce28df745f27c75f2604d33]]></key> </crypt> <disable_local_modul Es>false</disable_local_modules> <resources> <db> <table_prefix><! [cdata[]]></table_prefix> </db> <default_setup> <connection> 2. In model resource for the different databases that need to be used, override the _setresource method, for example
Class Hello_vip_model_entity_vip_adapter extends Mage_core_model_mysql4_abstract { protected $_logfile = ' Vip.adapter.log '; protected function _construct () { $this->_setresource (' read ' = ' vip_space_read ', ' write ' = ') Vip_space_read ')); }
With these two steps, you can use a different database in a model
Magento switching databases, using different databases