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

别来无恙 提交于 2019-12-12 01:58:28

问题


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:xxxxx@internal-db.sxxxxx.gridserver.com/dbxxxxx_toomodern.php file for 'dbxxxxx:xxxxx@internal-db.sxxxxx.gridserver.com/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:xxxxx@internal-db.sxxxxx.gridserver.com/dbxxxxx_toomodern.php file for 'dbxxxxx:xxxxx@internal-db.sxxxxx.gridserver.com/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:xxxxx@internal-db.sxxxxx.gridserver.com/dbxxxxx_toomodern.php file for 'dbxxxxx:xxxxx@internal-db.sxxxxx.gridserver.com/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:xxxxx@internal-db.sxxxxx.gridserver.com/dbxxxxx_toomodern.php file for 'dbxxxxx:xxxxx@internal-db.sxxxxx.gridserver.com/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:xxxxx@internal-db.sxxxxx.gridserver.com/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!


回答1:


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"; 


来源:https://stackoverflow.com/questions/6021729/where-can-i-find-a-list-of-pear-db-error-codes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!