title: How can I connect to second database with my cakephp application
body: <p>my application's requirement is that to display data of magento database table forexample admin_user that is reside at locally connected pc. 
  so I need to keep as it is my cakephp database values in displaying-modifying-etc, and in only one page magento's database value needs to be printed and updated.</p>
  
  <p>I have kept 2 variables in databse.php </p>
  
  <pre><code>public $default = array(
      'datasource' =&gt; 'Database/Mysql',
      'persistent' =&gt; false,
      'host' =&gt; 'localhost',
      'login' =&gt; 'root',
      'password' =&gt; '',
      'database' =&gt; 'myappdatabase',
      'prefix' =&gt; '',
      //'encoding' =&gt; 'utf8',
  );
      var $vsdatabase = array(    
      'datasource' =&gt; 'Database/Mysql',
      'persistent' =&gt; false,
      'host' =&gt; '192.168.1.36',   
      'login' =&gt; 'root',          
      'password' =&gt; '',           
      'database' =&gt; 'magento',    
      'prefix' =&gt; '',
      );
  </code></pre>
  
  <p>and in controller,</p>
  
  <pre><code>     App::import('Model','ConnectionManager');
  $db = ConnectionManager::getDataSource('vsdatabase');
  $database = $db-&gt;config['database'];
  $data = $this-&gt;User-&gt;query("select * from $database.admin_user as t1");
  </code></pre>
  
  <p>the host I like to keep as written above means default is from my local database and other is remote PC's magento database
  If I both host keep same then its working but if write different then It's not working</p>
  
  <p>So I solve this problem?
   Plz help me in finding out solution</p>