View Single Post
 
Old October 6th, 2005, 10:25 PM
bxh bxh is offline
Registered User
 
Join Date: Oct 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default PEAR DB Connection failure

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.