Subject: PEAR DB Connection failure
Posted By: bxh Post Date: 10/6/2005 10:25:33 PM
I can connect using the standard PHP method:

$connect = mysql_connect("localhost", "root", "mysql")
   or die("Cannot connect to the server.");

mysql_select_db("testDatabase");

$query = "select * from testTable";

$results = mysql_query($query)
  or die(mysql_error());
. . .

But I cannot connect using the PEAR DB method, although I use the same parameters:

$dsn = "mysql://root:mysql@localhost/testDatabase";

$db = DB::connect($dsn);

if (DB::isError($db)) {
    echo "Standard Message: " . $db->getMessage();
    echo "Standard Code: " . $db->getCode();
    echo "DBMS/User Message: " . $db->getUserInfo();
    echo "DBMS/Debug Message: " . $db->getDebugInfo();
    exit;
    //die ($db->getMessage());
    }

Standard Message: DB Error: not found
Standard Code: -4
DBMS/User Message: Unable to include the DB/mysql.php file for 'mysql://root:mysql@localhost/testDatabase'
DBMS/Debug Message: Unable to include the DB/mysql.php file for 'mysql://root:mysql@localhost/testDatabase'

Can anyone offer any reasons why this is so?  I'd really like to use PEAR DB.

I'm using PHP 5.0.5, Apache/2.0.54, and MySQL 4.1.7.

Thanks.

Go to topic 35482

Return to index page 458
Return to index page 457
Return to index page 456
Return to index page 455
Return to index page 454
Return to index page 453
Return to index page 452
Return to index page 451
Return to index page 450
Return to index page 449