Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5950457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:23:46+00:00 2026-05-22T17:23:46+00:00

I am using following configuration in application.ini for database; resources.db.adapter = Mysqli resources.db.params.host =

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:23:47+00:00Added an answer on May 22, 2026 at 5:23 pm

    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

    1. Can’t connect to external database with Zend Framework but mysql connect works.

    EDIT: I also discovered that even when I had the following lines in my Model inherited from Zend_Db_Table_Abstract it was not connecting to the remote DB.

    protected $_schema  = 'otherdb';
    protected $_adapter = 'db_remote'; 
    

    So I checked this function in Zend_Db_Table_Abstract

    protected function _setupDatabaseAdapter()
        {
            if (! $this->_db) {
                $this->_db = self::getDefaultAdapter();
                if (!$this->_db instanceof Zend_Db_Adapter_Abstract) {
                    require_once 'Zend/Db/Table/Exception.php';
                    throw new Zend_Db_Table_Exception('No adapter found for ' . get_class($this));
                }
            }
        }
    

    If its the same for you, add the following lines to your constructor:

    public function __construct() {
        $front = Zend_Controller_Front::getInstance();
        $bootstrap = $front->getParam('bootstrap');
        $resource = $bootstrap->getPluginResource('multidb');
        $this->_db = $resource->getDb('chdpg');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to host my service using following configuration. <system.serviceModel> <services> <service name=Test.MyService
I'm using following code to open the web.config of my current web application. Configuration
In my asp.net web application, I'm using asp.net forms authentication with following configuration. <authentication
I'm trying to get zc.buildout to install Gunicorn from source. Using the following configuration:
I am using Fluent NHibernate with an external 'hibernate.cfg.xml' file. Following is the configuration
I am using following PHP code to connect to MS Access database: $odb_conn =
i' m using BlazeDs. In services-config.xml we got following configuration of endPoint. <channel-definition id=any-amf
I need to build a web service application for my client, using the following
I'm using the following code to display unhandled exceptions in a WPF application: public
I am developing a mobile application using Appcelerator and am including some configuration functions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.