Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
| Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
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.");


$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();
    //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.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Anybody else learning to HATE pear::DB? biot023 BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 2 March 15th, 2005 04:58 AM
PEAR::Auth and PEAR::Auth_HTTP Ceriwaen Beginning PHP 1 February 18th, 2005 04:36 PM
pear db::connect turing PHP Databases 1 September 15th, 2004 05:22 PM
PEAR::DB Using Problem ruhin Beginning PHP 5 June 4th, 2004 12:50 AM
Using PEAR DB and Classes. TreacherousDog Beginning PHP 1 July 8th, 2003 01:02 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.