Re: DB and postgres: Persistent connection
| From: | Sylvain Gourvil | Date: | Thu, 16 Jun 2005 07:38:36 +0000 |
| Subject: | Re: DB and postgres: Persistent connection | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19647@lists.php.net to get a copy of this message | ||
Søren Schimkat wrote:
Hi Guys
I´m having troubles with persistent connections when connecting to my postgres server. I connect like this:
$dsn = $GLOBALS['db_type'] . '://' .
$GLOBALS['db_user'] . ':' .
$GLOBALS['db_pass'] . '@'.
$GLOBALS['db_host'] . ':' .
$GLOBALS['db_port'] . '/'.
$GLOBALS['db_name'];
$db = DB::connect($dsn);
The connection is made, but the connection hangs if a query is performed.
Do I need to disconnect() or is there an other trick for awoiding the persistent connections?
Yes, you nedd to disconnect after each query (if you don(t want a persistent connection).
You can connect and disconnect before and after each query. I used to do it.