Re: Apache::DBI and DBD::Pg

From: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>
To: Jeremy Nixon <jeremy(at)exit109(dot)com>
Cc: dbi-users(at)perl(dot)org, modperl(at)perl(dot)apache(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: Apache::DBI and DBD::Pg
Date: 2006-01-15 09:38:31
Message-ID: 20060115093831.GA1196@timac.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Jan 15, 2006 at 02:00:15AM +0000, Jeremy Nixon wrote:
> Tyler MacDonald <tyler(at)yi(dot)org> wrote:
>
> > [Fri Jan 13 23:46:28 2006] [error] [client 192.168.99.112] DBD::Pg::db
> > prepare_cached failed: FATAL: terminating connection due to administrator
>
> Here's the thing: if your database connection goes away, and Apache::DBI
> opens a new one, any prepared statement handles you might have become
> invalid, because prepared statements are per-connection.
>
> My way around it is to not use prepared statements.

Another, better, way is to use prepare_cached() along with connect_cached().

http://search.cpan.org/src/TIMB/DBI_AdvancedTalk_2004/sld029.htm and later slides.

Tim.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-01-15 13:43:19 Re: Row Size and Indexing
Previous Message Jonel Rienton 2006-01-15 09:10:57 Re: Moving PostgreSQL data directory on Windows