On Sun, Jan 15, 2006 at 02:00:15AM +0000, Jeremy Nixon wrote:
> Tyler MacDonald <tyler@yi.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.