[Catalyst] Shared database handles

John Wang johncwang at gmail.com
Mon May 8 03:38:18 CEST 2006


On 5/7/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
>
> Eduardo Anuel wrote:
> > I believe that the translation would be something like :
> >
> > "the prepared sentence  <<dbdpg_1>> already exists"
>
> Yeah, you're forking and failing to disconnect. The original post you
> linked is from Brandon Black, who is now a substantial DBIx::Class
> contributor and the architect of the code that makes DBIx::Class fork
> and thread-safe out of the box.
>
> You should probably consider upgrading your Class::DBI code to use
> DBIx::Class and overriding your DBI model to get the $dbh out of the
> DBIx::Class::Storage::DBI module - if that's not currently feasible
> examine the DBIx::Class implementation and see if you can backport it
> into your own code.


I ran into this problem in March and solved it by doing exactly that. At
first I also thought about adapting some CDBI connection code (since that's
what Google turned up) but I ended up extracting the connection code from
DBIC::Storage::DBI and turning it into a stand-alone DBI connection module
(DBIC::Storage::DBI has a lot of stuff I don't currently use). After
refactoring to get my $dbh from that module, the problem went away.

mst did mention it was a forking problem at the time but didn't give me such
a clear a roadmap to solve the problem - I had to find DBIC::Storage::DBI
myself. He's getting nicer :)

mst++
blblack++

On a side note, should Brandon be mentioned on the DBIC::Storage::DBI
authors section?

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20060507/6d4002c6/attachment.htm 


More information about the Catalyst mailing list