Re: [GENERAL] implementing a psql daemon - Mailing list pgsql-general

From Adriaan Joubert
Subject Re: [GENERAL] implementing a psql daemon
Date
Msg-id 38896A3B.452AA4ED@albourne.com
Whole thread Raw
In response to implementing a psql daemon  (Marc Tardif <admin@wtbwts.com>)
List pgsql-general
Marc Tardif wrote:

>
> The solution to this problem could be to write a daemon which would leave
> a connection open to a postgresql database. Then, when data is needed, I
> could pass the query using shared memory and perhaps semaphores to avoid
> concurrent access to the daemon therefore avoiding the overhead of
> creating a connection each time. I could then use this same method for my
> mailing list manager and each utility (which would have to be re-written
> in c) all of which would use the same connection provided by the daemon.

A lot of this type of code has been written before. I found in similar
situations that the easiest way to do this is to use an Apache web server
with mod_perl or fastcgi (mod_perl is a more robust when it comes to database
links, or rather, it requires less work on your part). Using DBI and DBD-Pg
you get your database access quite easily, and as it is a web server it is
trivial to knock up an interface with perl and CGI. You immediately have an
interface to the thing and all the hard work is available for free.

Adriaan


pgsql-general by date:

Previous
From: Omkar Prabhu
Date:
Subject: ...
Next
From: Peter Mount
Date:
Subject: Re: [GENERAL] jdbc connect in StarOffice