title: Problem connecting to postgres with Kohana 3 database module on OS X Snow Leopard
body: <p>Edits/Additions at bottom...</p>
  
  <p>Environment:</p>
  
  <p>Mac OS X 10.6 Snow Leopard<br>
  PHP 5.3<br>
  Kohana 3.0.4  </p>
  
  <p>When I try to configure and use a connection to a postgresql database on localhost I get the following error:</p>
  
  <blockquote>
    <p>ErrorException [ Warning ]: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock)</p>
  </blockquote>
  
  <p>Here is the configuration of the database in /modules/database/config/database.php (note the third instance named 'pgsqltest')</p>
  
  <pre><code>return array
  (
  'default' =&gt; array
  (
      'type'       =&gt; 'mysql',
      'connection' =&gt; array(
          /**
           * The following options are available for MySQL:
           *
           * string   hostname
           * string   username
           * string   password
           * boolean  persistent
           * string   database
           *
           * Ports and sockets may be appended to the hostname.
           */
          'hostname'   =&gt; 'localhost',
          'username'   =&gt; FALSE,
          'password'   =&gt; FALSE,
          'persistent' =&gt; FALSE,
          'database'   =&gt; 'kohana',
      ),
      'table_prefix' =&gt; '',
      'charset'      =&gt; 'utf8',
      'caching'      =&gt; FALSE,
      'profiling'    =&gt; TRUE,
  ),
  'alternate' =&gt; array(
      'type'       =&gt; 'pdo',
      'connection' =&gt; array(
          /**
           * The following options are available for PDO:
           *
           * string   dsn
           * string   username
           * string   password
           * boolean  persistent
           * string   identifier
           */
          'dsn'        =&gt; 'mysql:host=localhost;dbname=kohana',
          'username'   =&gt; 'root',
          'password'   =&gt; 'r00tdb',
          'persistent' =&gt; FALSE,
      ),
      'table_prefix' =&gt; '',
      'charset'      =&gt; 'utf8',
      'caching'      =&gt; FALSE,
      'profiling'    =&gt; TRUE,
  ),
  'pgsqltest' =&gt; array(
      'type'       =&gt; 'pdo',
      'connection' =&gt; array(
          /**
           * The following options are available for PDO:
           *
           * string   dsn
           * string   username
           * string   password
           * boolean  persistent
           * string   identifier
           */
          'dsn'        =&gt; 'mysql:host=localhost;dbname=pgsqltest',
          'username'   =&gt; 'postgres',
          'password'   =&gt; 'dev1234',
          'persistent' =&gt; FALSE,
      ),
      'table_prefix' =&gt; '',
      'charset'      =&gt; 'utf8',
      'caching'      =&gt; FALSE,
      'profiling'    =&gt; TRUE,
  ),
  );
  </code></pre>
  
  <p>And here is the code to create the database instance, create a query and execute the query:</p>
  
  <pre><code>$pgsqltest_db  = Database::instance('pgsqltest');
  $query = DB::query(Database::SELECT, 'SELECT * FROM test')-&gt;execute();
  </code></pre>
  
  <p>I'm continuing to research a solution for this error but thought I'd ask to see if someone else has already found a solution.  Any ideas are welcome.  </p>
  
  <p>One other note is that I know my build of PHP can access this postgresql db since I'm able to manage the db using phpPgAdmin.  But I have yet to determine what phpPgAdmin is doing differently to connect to the db than what Kohana 3 is attempting.  </p>
  
  <p>Bart</p>
  
  <p>///////////// EDIT ONE /////////////</p>
  
  <p>Based on Matt's comment I changed the following in the configuration of the 'pgsqltest' database instance.  </p>
  
  <p>from  </p>
  
  <pre><code>'dsn'        =&gt; 'mysql:host=localhost;dbname=pbeeep',  
  </code></pre>
  
  <p>to  </p>
  
  <pre><code>'dsn'        =&gt; 'pgsql:host=localhost;dbname=pbeeep',  
  </code></pre>
  
  <p>I also changed the execution of the query. </p>
  
  <p>from   </p>
  
  <pre><code>$query = DB::query(Database::SELECT, 'SELECT * FROM test')-&gt;execute();  
  </code></pre>
  
  <p>to  </p>
  
  <pre><code>$query = DB::query(Database::SELECT, 'SELECT * FROM test')-&gt;execute($pgsqltest_db);  
  </code></pre>
  
  <p>Now I get the following error </p>
  
  <blockquote>
    <p>PDOException [ 0 ]: could not find driver</p>
  </blockquote>
  
  <p>I'm not sure if this is progress or not but it's more info to share.  </p>