> -----Original Message-----
> From: Tamas [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 13, 2000 4:46 AM
> To: Geoffrey Young
> Subject: RE: ApacheDBI persistant connections
>
>
> > > I have a problem with persistant connections from my
> PerlAuthHandler.
> > >
> > > If you request a page, then I get 2 persistant connections to the
> > > database. The quickly become sleeping connections. Fine so far.
> > > Wait around 30 seconds and then refresh the page. And get another
> > > 2 sleeping connections. Obviously something is not right.
> >
> > Apache::DBI caches connections per-connect string and per
> apache child -
> > thus
> > if you have 5 children and each foo.pl connects to two
> databases, you
> > eventually will get
> > 10 database connections...
>
> I'm following things so far :)
> I have Authen and Authz, so two objects (connections) are made
> for each 'secure' request.
not just by virtue of there being two handlers - Apache::DBI doesn't care
which handler makes the connection, just what the connect string is...
that is, any call to
my $dbh = DBI->connect('dbi:Oracle:$DBASE', $DBUSER, $DBPASS,
{RaiseError => 1, AutoCommit => 1, PrintError => 1}) || die $DBI::errstr;
will result in the same connection (per child, of course)
as soon as you change anything (like RaiseError => 0 or $DBUSER) you get a
new connection...
If Authen and Authz each have different $dbh credentials, then yes, you
should get two connections...
once the processing is finished, each connection will sleep until one of two
things:
you hit the same apache child again
the database cleans them up becuase they have been idle for too long
that's the benefit/drawback of Apache::DBI
> > >
> > > I have a DESTROY function that I call (
> $self->{dbh}->disconnect ),
> > > but that doesn't appear to make any difference.
> >
> > no need to worry about that, disconnect() is a no-op under
> Apache::DBI...
>
> Which is what I thought, but the sleeping processes confused me.
>
> So infact what is heppening is that Apache is spawning threads, each
> with 2 Auth connections without the old ones dying. Possibly then
> I can change the keep-alive on Apache to be less?
I don't think keep-alive has anything to do with it...
I suggest you set $Apache::DBI::DEBUG = 2 in your startup.pl and watch the
debug information under httpd -X
HTH
--Geoff
>
> Arg, the more I delve the further round the circle I get :)
>
> Thanks
>
> Tom
>