#18913 [NEW]: pg_pconnect fails when trying to connect to a different DB

From: Date: Thu, 15 Aug 2002 07:30:51 +0000
Subject: #18913 [NEW]: pg_pconnect fails when trying to connect to a different DB
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-16887@lists.php.net to get a copy of this message
From: jc@mega-bucks.co.jp Operating system: Red Hat Linux 7.2 PHP version: 4.2.2 PHP Bug Type: PostgreSQL related Bug description: pg_pconnect fails when trying to connect to a different DB It seems that I cannot use pg_pconnect to connect to more than on database at a time? The following code fails with this error: Warning: pg_pconnect() cannot create new link. Too many open links (1) in /www/htdocs/jc/t2.php on line 26 Warning: pg_exec(): supplied argument is not a valid PostgreSQL link resource in /www/htdocs/jc/t2.php on line 27 CONNECTION: could not execute query2 (select now()) <?php $sql = "select now()"; //uncommenting one of the following lines will make the code work $res1 = sql_query($sql); $res2 = sql_query2($sql); $dat = pg_fetch_object($res1); //or res2 as the case maybe echo $dat->now; function sql_query($sql) { $conn = pg_pconnect("dbname=JC user=postgres"); $res = pg_exec($conn, $sql); if (!$res) { echo "CONNECTION: could not execute query ($sql)<br>"; die; } else { return $res; } } function sql_query2($sql) { $conn = pg_pconnect("dbname=sessions user=postgres"); $res = pg_exec($conn, $sql); if (!$res) { echo "CONNECTION: could not execute query2 ($sql)<br>"; die; } else { return $res; } } ?> -- Edit bug report at http://bugs.php.net/?id=18913&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=18913&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=18913&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=18913&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=18913&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=18913&r=support Expected behavior: http://bugs.php.net/fix.php?id=18913&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=18913&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=18913&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=18913&r=globals

« previous php.bugs (#16887) next »