Re: MDB2 connect failure - php5,

From: Date: Mon, 12 Mar 2007 17:53:53 +0000
Subject: Re: MDB2 connect failure - php5,
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-26827@lists.php.net to get a copy of this message
On 3/11/07, rwhartung <rwhartung@rgimaging.com> wrote:
Hi all - some progress. I am a newbie. I have a test database - bpsimple. I can log in from the command line with username minitwr and pwd RWHart (not production and not online). pear list reports: Installed packages, channel pear.php.net: =========================================
Package           Version State
Archive_Tar       1.3.1   stable
Console_Getopt    1.2     stable
DB                1.7.6   stable
MDB2              2.3.0   stable
MDB2_Driver_pgsql 1.3.0 stable
PEAR              1.4.9   stable
XML_RPC           1.5.0   stable
require_once 'MDB2.php' ; $dsn = "pgsql://minitwr:RWHart@localhost/bpsimple" ;
Your problem is likely that you're using a different username and database name. Oracle has some strange ways of forcing usernames to also be a DB that causes querying problems so MDB2 has an option to simulate a normal RDBMS. Unfortunately this means that using a different username than database name can be confusing. Try using: $dsn = 'pgsql://minitwr:RWHart@localhost/minitwr'; and adding the database name before your table names in your queries.
$mdb2 =& MDB2::connect($dsn) ; if (PEAR::isError($mdb2) ) {
    die( "Error Reported: " . $mdb2->getMessage() . "\n"."<br />" ) ;
} print "ERROR REPORTED: " . $errorReported ."\n" . "<br/>" ; In php5 I use the following script that reports that it cannot connect with :
     MDB2 Error: connect failed.
require_once 'MDB2.php' ; $dsn = "pgsql://minitwr:RWHart@localhost/bpsimple" ; $mdb2 =& MDB2::connect($dsn) ; if (PEAR::isError($mdb2) ) {
    die( "Error Reported: " . $mdb2->getMessage()  ) ;
} Note that the username and password are identical to those used with psql on the command line. I can connect with pg_connect() without any problem. I have tried various combinations of require-once (e.g. require_once "MDB2.php", require_once("MDB2.php") and it doesn't make any difference. ideas? Thanks, Bob -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- Justin Patrin

« previous php.pear.general (#26827) next »