[Catalyst-dev] Is it possible to have fastCGI keep persistent database handle?

Darren Duncan darren at darrenduncan.net
Tue Apr 5 19:10:08 GMT 2011


Joseph He wrote:
> With fastCGI, I can achieve persistent script so I can save loading time,
> but I find that I don't have persistent dbi handle? Each time the
> application runs, database also opens a fresh handle.
> 
> Search on net, people say Apache::DBI can do the job, but I found mod_perl
> is its prerequisite.
> 
> Is it really possible to have persistent DB handle with Perl/fastCGI? My
> environment is Windows, SQL server, Perl.

Use DBIx::Connector, http://search.cpan.org/dist/DBIx-Connector/ , which is the 
best solution on CPAN for this issue.  It works properly for both FastCGI and 
mod_perl and anything else, taking care of any gotchas.  It is also simple and 
can be used with plain DBI, no ORM baggage required, or it works with ORMs too, 
so either way you have a choice. -- Darren Duncan



More information about the Catalyst-dev mailing list