Magento switching databases, using different databases

Source: Internet
Author: User
Tags cdata crypt

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.