Search code examples
phpmysqldatabasepear

Where can I find a list of PEAR DB error codes?


I'm trying to establish a connection to a mysql database using PEAR DB. It's throwing the following error at me:

DB_Error Object ( [error_message_prefix] => [mode] => 1 [level] => 1024 [code] => -4 [message] => DB Error: not found [userinfo] => Unable to include the DB/dbxxxxx:[email protected]/dbxxxxx_toomodern.php file for 'dbxxxxx:[email protected]/dbxxxxx_toomodern' [backtrace] => Array ( [0] => Array ( [file] => /usr/local/php-5.2.14-2/share/pear/DB.php [line] => 966 [function] => PEAR_Error [class] => PEAR_Error [type] => -> [args] => Array ( [0] => DB Error: not found [1] => -4 [2] => 1 [3] => 1024 [4] => Unable to include the DB/dbxxxxx:[email protected]/dbxxxxx_toomodern.php file for 'dbxxxxx:[email protected]/dbxxxxx_toomodern' ) ) [1] => Array ( [file] => /usr/local/php-5.2.14-2/share/pear/PEAR.php [line] => 531 [function] => DB_Error [class] => DB_Error [object] => DB_Error Object RECURSION [type] => -> [args] => Array ( [0] => -4 [1] => 1 [2] => 1024 [3] => Unable to include the DB/dbxxxxx:[email protected]/dbxxxxx_toomodern.php file for 'dbxxxxx:[email protected]/dbxxxxx_toomodern' ) ) [2] => Array ( [file] => /usr/local/php-5.2.14-2/share/pear/DB.php [line] => 543 [function] => raiseError [class] => PEAR [object] => DB Object ( ) [type] => -> [args] => Array ( [0] => [1] => -4 [2] => [3] => [4] => Unable to include the DB/dbxxxxx:[email protected]/dbxxxxx_toomodern.php file for 'dbxxxxx:[email protected]/dbxxxxx_toomodern' [5] => DB_Error [6] => 1 ) ) [3] => Array ( [file] => /nfs/c07/h04/mnt/xxxxx/domains/wedding.juicywatermelon.com/html/validate.php [line] => 9 [function] => connect [class] => DB [object] => DB Object ( ) [type] => -> [args] => Array ( [0] => dbxxxxx:[email protected]/dbxxxxx_toomodern ) ) ) [callback] => ) 1

my code is as follows:

<?php
  require_once('DB.php');
  $db = new DB;
  $db_host = 'internal-db.sxxxxx.gridserver.com'; 
  $db_user = 'xxxxx'; 
  $db_pass = 'xxxxx'; 
  $db_name = 'xxxxx'; 
  $dsn = "$db_user:$db_pass@$db_host/$db_name"; 
  $resource = $db->connect($dsn);
}

Can anyone see my error here? Is there an index of PEAR errors online, I can't for the life of me find them!


Solution

  • You also have to inlcude the DB type, so if it's MySQL, you would need to change it to

    $dsn = "mysql://$db_user:$db_pass@$db_host/$db_name";