[Catalyst] Shared database handles

Eduardo Anuel eanuel at gmail.com
Mon May 8 02:22:37 CEST 2006


I'm using Catalyst::Model::DBI wich tries to accomplish a persistent
$dbh, without suceed (in my opinion) the problem was triying to do
that, now that I open and close the connections myself there are no
problems.

On 5/7/06, Len Jaffe <lenjaffe at jaffesystems.com> wrote:
>
>
> --- Matt S Trout <dbix-class at trout.me.uk> wrote:
>
> > Len Jaffe wrote:
> > >
> > > --- Eduardo Anuel <eanuel at gmail.com> wrote:
> > >
> > >
> > >> There is an explanation to the issue there and a
> > >> solution for Class
> > >> DBI, but sadly in my application I use mostly
> > pure
> > >> DBI with the
> > >> Catalyst::Model::DBI module,
> > >
> > > Make sure that you're using Apache::DBI in your
> > > setup.pl.  Make sure that you don't make your DB
> > > connection in setup.pl, but do connect early in
> > your
> > > handler. Make liberal use of connect_cached() and
> > > prepare_cached().
> >
> > Actually, if you're already using Apache::DBI I'd
> > recommend dumping it
> > and seeing if that fixes the problem; it does all
> > sorts of silly magic
> > that breaks spectacularly on edge cases.
> >
> > Apache::DBI is fine if you always call DBI->connect
> > yourself and don't
> > persist a $dbh anywhere. If not, it's
> > almost-certain-death. Don't risk it.
> >
>
> RIght, and since he's using "pure DBI", he's probabaly
> calling connect himself.  Changes are he's calling it
> in setup.pl instead of in the children. Hence my
> advice to use connect_cached().
>
> As far as I know, I've never personnaly persisted a
> $dbh, and can't readily think of a reason to.  It's a
> huge win to connect once and stay connected.
>
> How else does one do persistent $dbh ?
>
> Len.
>
> Leonard A. Jaffe     lenjaffe at jaffesystems.com
> Leonard Jaffe Computer Systems Consulting Ltd.
> Columbus, OH, USA 614-404-4214 F: 530-380-7423
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>


--
Think for yourself...Question Authority



More information about the Catalyst mailing list