You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Joe Grastara <gr...@saturn.med.nyu.edu> on 2001/01/05 23:13:46 UTC

DBI

I have a question concerning database access under mod_perl.
Can the stardard DBI.pm module be use with mod_perl or does the
Apache::DBI module have to be used instead?

Thanks in advance for any help.

Joe Grastara
Project Assistant
Digital Media Center
The Skirball Institute Of Biomolecular Medicine
New York University Medical Center
540 First Ave., New York City, NY 10016 USA 
grastara@saturn.med.nyu.edu
http://www.med.nyu.edu/graphics



Re: DBI

Posted by Buddy Lee Haystack <ha...@email.rentzone.org>.
> Bad generic advice.  You should use persistent connections when it
> makes sense to use them.
> 
> BLH> Whether or not you use mod_perl is irrelevant.
> 
> It is relevent if you want to use Apache::DBI.


Ouch!

I was a bit more specific in my follow-up email which I sent direct since I didn't think it was necessary to post it to the list, but I may have been mistaken. It's difficult to provide detailed advice when you don't have all the information, so I did my best.


Subject: Re: DBI
   Date: Fri, 05 Jan 2001 17:56:53 -0500
   From: Buddy Lee Haystack <ha...@email.rentzone.org>
 Organization: www.RentZone.org
           To: Joe Grastara <gr...@saturn.med.nyu.edu>
   References: 1


When I first "migrated" from a Windows environment, I was absolutely amazed at how the
Unix people cobbled together independent pieces of software to solve systems integration
issues that plagued me in corporate americana.

A couple of issues.

When you use the Apache DBI module to maintain persistent connections to your database,
each Apache child process inherits one of the database handles, and caches the
connection. This means that your database will have to be able to have one database
connection open for each Apache child process running. If you have Apache configured to
spawn 20 child processes, the database your connecting to will have to be able to handle
at least the number of connections opened by just the single webserver.

I use PostgreSQL, which is compiled to handle just over 30 open connections. My website
uses 20 of those connections, which allows just over 10 other people to open up
connections to the database.

There is some undocumented command in DBI that will allow you to open a connection with
the Apache DBI module installed, but not cache the connection. I used this to connect to
an HR database that was rarely ever accessed.

ENJOY!!!


-- 
www.RentZone.org

Re: DBI

Posted by Vivek Khera <kh...@kciLink.com>.
>>>>> "BLH" == Buddy Lee Haystack <ha...@email.rentzone.org> writes:

BLH> There are two components to DBI. The perl module is required for
BLH> database access, but the Apache DBI module is not. Although you
BLH> really should use the Apache DBI module to maintain persistent
BLH> connections to your database.

Bad generic advice.  You should use persistent connections when it
makes sense to use them.

BLH> Whether or not you use mod_perl is irrelevant.

It is relevent if you want to use Apache::DBI.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera@kciLink.com       Rockville, MD       +1-240-453-8497
AIM: vivekkhera Y!: vivek_khera   http://www.khera.org/~vivek/

Re: DBI

Posted by Buddy Lee Haystack <ha...@email.rentzone.org>.
There are two components to DBI. The perl module is required for database access, but the Apache DBI module is not. Although you really should use the Apache DBI module to  maintain persistent connections to your database.

Whether or not you use mod_perl is irrelevant.


Joe Grastara wrote:
> 
> I have a question concerning database access under mod_perl.
> Can the stardard DBI.pm module be use with mod_perl or does the
> Apache::DBI module have to be used instead?
> 
> Thanks in advance for any help.
> 
> Joe Grastara
> Project Assistant
> Digital Media Center
> The Skirball Institute Of Biomolecular Medicine
> New York University Medical Center
> 540 First Ave., New York City, NY 10016 USA
> grastara@saturn.med.nyu.edu
> http://www.med.nyu.edu/graphics

-- 
www.RentZone.org