title: cakePHP 2.x connecting to a remote database using key
body: <p>I need to get connected with a mysql database on a different server, i have the RSA key to connect to the server and i also have all the credentials needed to connect to the database, and using this following codes, i am able to get connected perfectly</p>
  
  <pre><code>try {
      $this-&gt;db = new PDO("mysql:host=$this-&gt;host;port=$this-&gt;port;dbname=$this-&gt;dbname", $this-&gt;sqlUser, $this-&gt;sqlPass);
  } catch (Exception $e) {
      shell_exec("ssh -i /path/to/rsa/key/the_key myusername@some.ip.address -L3307:localhost:3306 -N");
  };
  
  try {
      $this-&gt;db = new PDO("mysql:host=$this-&gt;host;port=$this-&gt;port;dbname=$this-&gt;dbname", $this-&gt;sqlUser, $this-&gt;sqlPass);
  } catch (Exception $e) {
      die($e-&gt;getMessage() . " (line:" . __LINE__ . ")");
  };
  </code></pre>
  
  <p>however, i am building the application using cakePHP 2.x, how can i connect to that remote server and database using cakePHP's configuration?</p>
  
  <p>Thanks</p>