On Tuesday, 02 August 2011 15:30:28 Feng He wrote:
> I just want to develop a modperl application.
> It's a handler, the database is Mysql.
> Shall I use Apache::DBI, or DBI is just fine ?

It depends. Apache::DBI provides a transparent connection cache. You can 
forget the DB handle acquired at some time at the end of the request. The 
next DBI::connect will then fetch the handle from the Apache::DBI cache.

On the other hand, all modern DBI versions have connect_cached() (only 
ancient version lack this function) which provides much the same 
functionality.

Further, applications that are implemented as modperl handlers often tend 
to use a singleton to store the DBI handle. In this case Apache::DBI is 
not necessary. However, in this scenario you'll have to take care of 
cases when the connection is dropped unexpectedly. Nevertheless, I'd 
prefer this strategy for new development because it gives you maximum 
control over what is going on. But that's just my humble opinion.

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net

Reply via email to