From: Ken Wills <gfccall@mailbag.com>
To: pgsql-interfaces@hub.org
Subject: Anyone got any advice or pointers on using Pg, mod_perl and persistant DB connections with apache
Date: Fri, 23 Oct 1998 13:00:32 -0500
Message-ID: <008601bdfeaf$08389620$031f46c6@kpw.gfc.net> (raw)
I'm using Apache 1.3.1 with mod_perl (latest). I want to open a single persistant db connection
to postgres and feed all the info to and from apache from this. Currently i'm doing this :
my $conn = Pg::connectdb("dbname=$db_name host=$db_host user=$db_user password=$db_password");
my $query = new CGI;
...etc..
..do the query...
..etc..
and it works fine, except for the fact that it starts a new postgres process to do the query, but never
seems
to close it. (How do you close them? I've tried using PQfinish...)I understand that this method is supposed
to do that. I've tried globaly declaring a connection in apache's startup.perl script, but have had no
success with that - if I try something like :
use CGI;
use Pg;
use Shell qw(cat);
if ($dbh->status == PGRES_CONNECTION_BAD) {
$dbh = Pg::connectdb("dbname=$db_name host=$db_host user=$db_user password=$db_password");
}
at the top of each script, it complains that I have to 'use' Pg before I can do the $dbh->status check.
I have read all the docs, manpages etc for pointers on how to do this, with no real mention of anything.
mod_perl has a
brief pointer on how to do it with DBI. Would I be better off using DBI.
Any help/pointers very appreciated.
Thanks
Ken
Ken Wills
GFC Call Center
Email: gfchelp@gflesch.com
Phone: 1-888-4325556
Fax: 1-608-2222432
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: gfccall@mailbag.com, pgsql-interfaces@hub.org
Subject: Re: Anyone got any advice or pointers on using Pg, mod_perl and persistant DB connections with apache
In-Reply-To: <008601bdfeaf$08389620$031f46c6@kpw.gfc.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox