Em Seg 26 Abr 2004 16:03, Gabriel de Rezende e Lamounier escreveu: > i have pear set up on my include_path. > postgresql is running and i'm able to connect and query it using > pg_connect() and pg_query(). > i can't conect to pgsql using pear db. here's the script: > > <html> > <body> > <?php > require_once("DB.php"); > > $dsn = "pgsql://postgres/teste"; > $db = DB::connect($dsn); > > if (DB::isError($db)) > { > die($db->getMessage()); > } > > $db->disconect(); > ?> > </body> > </html> > > error message on the browser: > > DB Error: connect failed > > it's just a test server, the postgres user dosn't have a password set. > using the native pgsql functions i connect like this: > > $db = pg_connect("dbname=teste user=postgres"); > > any idea?
the intereting thing is that i can connect using the following syntax: <html> <body> <?php require_once("DB.php"); $dsn = array( 'phptype' => "pgsql", 'hostspec' => "", 'database' => "teste", 'username' => "postgres", 'password' => "" ); $db = DB::connect($dsn); if (DB::isError($db)) { die($db->getMessage()); } $db->disconnect(); ?> </body> </html>