You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Clayton Cottingham aka drfrog <dr...@smartt.com> on 2001/06/03 21:28:20 UTC

advice on Apache::DBI Apache::Session and Apache::AuthCookieDBI intergration

Hi all,
ive just been researching these
a bit and I'm wondering if anyone has good advice/links on how to 
link these three Modules together ?


heres what im caught on :
1.is it best to load Apache::DBI at start up of apache and can i load more than
one connection type?
2.is it best to login and then set session or set session and then log in
3. what about 'last session' type storage
4. if Apache::DBI is on at startup how can i load a specific connection type
for Sessions?

i think that's all  the really big questions i have


system info 
mandrake 7.2 with Apache1.3.12, modperl 1.,& postgres 7.1
700Mhz 312 mb ram 




Re: advice on Apache::DBI Apache::Session and Apache::AuthCookieDBI intergration

Posted by Martin Redington <m....@ucl.ac.uk>.
On Sunday, June 3, 2001, at 12:28  pm, Clayton Cottingham aka drfrog 
wrote:
>
> heres what im caught on :
> 1.is it best to load Apache::DBI at start up of apache and can i load 
> more than
> one connection type?

yes via PerlModule or a PerlRequire for a startup.pl. My understanding 
is that forked children will get a copy of the pre-loaded module, rather 
than having to load it afresh. This will save you each http child 
loading the module when it is first used.

re connection types, these are usually pulled in with a startup.pl line 
something like

$dbh = Apache::DBI->connect_on_init("$driver", "$user", "$pwd");

AFAIK, Apache::DBI performs connection caching based on a hash of the 
connection parameters,
so next time Apache sees a connect with the same $driver/$user/$pwd 
combo, it will hand out a pre-opened connection, if it has one. If you 
open a connection for a different user/pwd connection, Apache::DBI will 
open a new connection.

To get this other connection pre-opened, just add

$dbh2 = Apache::DBI->connect_on_init("$driver2", "$user2", "$pwd2");

to your startup.pl

I haven't used Apache::Session, so I can't help you with the rest ...

    cheers,
          Martin

> 2.is it best to login and then set session or set session and then log 
> in
> 3. what about 'last session' type storage
> 4. if Apache::DBI is on at startup how can i load a specific connection 
> type
> for Sessions?
>
> i think that's all  the really big questions i have
>
>
> system info
> mandrake 7.2 with Apache1.3.12, modperl 1.,& postgres 7.1
> 700Mhz 312 mb ram
>
>
>
>