title: Multiple Database connection issue CakePHP v2.x
body: <p>I am using CakePHP v2.x. My current Database is MySQL. My need is to connect to other     Database within a method/function written under controller. So what I did so far is add another DB connection  array $test in Config/database.php. </p>
  
  <pre><code>class DATABASE_CONFIG {
  
  public $default = array(
      'datasource' =&gt; 'Database/Mysql',
      'persistent' =&gt; false,
      'host'       =&gt; 'localhost',
      'login'      =&gt; 'test',
      'password'   =&gt; 'test1',
      'database'   =&gt; 'test_portal',
      'prefix'     =&gt; ''
      //'encoding' =&gt; 'utf8',
  );
  
  public $test = array(
      'datasource'    =&gt; 'Database/Mysql',
      'persistent'    =&gt; false,
      'host'      =&gt; 'localhost',
      'login'     =&gt; 'dfffd_23',
      'password'  =&gt; 'dsfsd324',
      'database'  =&gt; 'testdbuser',
      'prefix'    =&gt; ''
      //'encoding'    =&gt; 'utf8',
  );
  }
  </code></pre>
  
  <p>I need to connect a table named 'aezips'.So I created a new Model;</p>
  
  <pre><code>class Aezips extends AppModel { 
  
    public $name      = 'Aezip'; 
    public $useDbConfig   = 'test';
    //public $useTable        = 'aezips';
  
  }
  </code></pre>
  
  <p>In my controller added ;</p>
  
  <pre><code>public $uses = array('Aezip');
  </code></pre>
  
  <p>Controller having a function/method named add,   </p>
  
  <pre><code>public function add() {
  
  
          $this-&gt;layout = NULL;
          $this-&gt;autoRender = false; //will prevent render of view
  
  
  
          if($this-&gt;RequestHandler-&gt;isAjax()){
               Configure::write('debug', 0); //it will avoid any extra output
            }
  
  
          //$this-&gt;Aezip-&gt;useDbConfig('test'); 
  
          $t = $this-&gt;Aezip-&gt;find('all');     //To fetch data from aezips table
          print_r($t);    
  
          print_r($this-&gt;data);
  
  
  
  }
  </code></pre>
  
  <p>But I can't connect to Aezip table and it doesn't shows any error. Both Database residing from same server but different cpanel account.</p>