在哪里可以找到PEAR DB错误代码列表?

时间:2011-05-16 18:30:59

标签: php mysql database pear

我正在尝试使用PEAR DB建立与mysql数据库的连接。它向我抛出以下错误:

  

DB_Error对象(   [error_message_prefix] => [mode] => 1   [level] => 1024 [code] => -4   [message] => DB错误:未找到   [userinfo] =>无法包括   DB / dbxxxxx:xxxxx@internal-db.sxxxxx.gridserver.com/dbxxxxx_toomodern.php   档案   'dbxxxxx:xxxxx@internal-db.sxxxxx.gridserver.com/dbxxxxx_toomodern'   [backtrace] =>数组([0] =>数组(   [file] =>   /usr/local/php-5.2.14-2/share/pear/DB.php   [line] => 966 [功能] => PEAR_Error的   [class] => PEAR_Error [type] => - >   [args] =>数组([0] =>数据库错误:没有   发现[1] => -4 [2] => 1 [3] => 1024   [4] =>无法包括   DB / dbxxxxx:xxxxx@internal-db.sxxxxx.gridserver.com/dbxxxxx_toomodern.php   档案   'dbxxxxx:xxxxx@internal-db.sxxxxx.gridserver.com/dbxxxxx_toomodern'   ))[1] =>数组([file] =>   /usr/local/php-5.2.14-2/share/pear/PEAR.php   [line] => 531 [function] => DB_Error   [class] => DB_Error [object] =>   DB_Error对象 RECURSION [type] =>    - > [args] =>数组([0] => -4 [1] => 1 [2] => 1024 [3] =>无法包括   该   DB / dbxxxxx:xxxxx@internal-db.sxxxxx.gridserver.com/dbxxxxx_toomodern.php   档案   'dbxxxxx:xxxxx@internal-db.sxxxxx.gridserver.com/dbxxxxx_toomodern'   ))[2] =>数组([file] =>   /usr/local/php-5.2.14-2/share/pear/DB.php   [line] => 543 [function] => RAISEERROR   [class] => PEAR [object] =>数据库对象   ()[type] => - > [args] =>数组([0]   => [1] => -4 [2] => [3] => [4] =>无法包括   DB / dbxxxxx:xxxxx@internal-db.sxxxxx.gridserver.com/dbxxxxx_toomodern.php   档案   'dbxxxxx:xxxxx@internal-db.sxxxxx.gridserver.com/dbxxxxx_toomodern'   [5] => DB_Error [6] => 1))[3] =>   数组([file] =>   /nfs/c07/h04/mnt/xxxxx/domains/wedding.juicywatermelon.com/html/validate.php   [line] => 9 [功能] =>连   [class] => DB [object] =>数据库对象(   )[type] => - > [args] =>数组([0]   => dbxxxxx:xxxxx@internal-db.sxxxxx.gridserver.com/dbxxxxx_toomodern   )))[callback] => )1

我的代码如下:

<?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);
}

有人可以在这看到我的错误吗? 网上是否有PEAR错误索引,我不能为我的生活找到它们!

1 个答案:

答案 0 :(得分:1)

您还必须包含数据库类型,因此如果是MySQL,则需要将其更改为

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