You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Differentiated Software Solutions Pvt. Ltd" <di...@vsnl.com> on 2000/10/23 09:55:55 UTC

persistent database problem

Hi,
    I have started with one httpd; and executed the following mod-perl program from the browser. We've configured apache to have persistent DBI
    The idea is first time the database handle will be inactive and it will print 'INSIDE'.  From the second time onwards the database handle will be active and it will print 'OUTSIDE'.  This is working.
    But, sometimes the 'OUTSIDE' comes from the third or fourth time only.  (that is it takes more than one attempt to become persistent) Why it is happening like this?
Thanks
Muthu S Ganesh

mod-perl code is here:

$rc = $dbh_pg->{Active};
print "$$: $rc\n";
if($rc eq '')
{
        print "INSIDE\n";
        $dbh_pg = DBI->connect("dbi:Pg:dbname=adcept_smg_ctrl","postgres","postgres",{RaiseError => 1}) || die $DBI::errstr;
}
else
{
        print "OUTSIDE\n";
}


Differentiated Software Solutions Pvt. Ltd.
176, Ground Floor, 6th Main,
2nd Block, RT Nagar
Bangalore - 560032
Phone : 91 80 3431470
www.diffs-india.com

Re: persistent database problem

Posted by "Differentiated Software Solutions Pvt. Ltd" <di...@vsnl.com>.
Yes
----- Original Message -----
From: Jeff Beard <be...@cyberxape.com>
To: Differentiated Software Solutions Pvt. Ltd <di...@vsnl.com>
Cc: <mo...@apache.org>
Sent: Monday, October 23, 2000 7:08 PM
Subject: Re: persistent database problem


> Are using Apache::DBI and establishing a connection in
> your startup.pl?
>
> On Mon, 23 Oct 2000, Differentiated Software Solutions Pvt. Ltd wrote:
>
> > Hi,
> >     I have started with one httpd; and executed the following mod-perl
program from the browser. We've configured apache to have persistent DBI
> >     The idea is first time the database handle will be inactive and it
will print 'INSIDE'.  From the second time onwards the database handle will
be active and it will print 'OUTSIDE'.  This is working.
> >     But, sometimes the 'OUTSIDE' comes from the third or fourth time
only.  (that is it takes more than one attempt to become persistent) Why it
is happening like this?
> > Thanks
> > Muthu S Ganesh
> >
> > mod-perl code is here:
> >
> > $rc = $dbh_pg->{Active};
> > print "$$: $rc\n";
> > if($rc eq '')
> > {
> >         print "INSIDE\n";
> >         $dbh_pg =
DBI->connect("dbi:Pg:dbname=adcept_smg_ctrl","postgres","postgres",{RaiseErr
or => 1}) || die $DBI::errstr;
> > }
> > else
> > {
> >         print "OUTSIDE\n";
> > }
> >
> >
> > Differentiated Software Solutions Pvt. Ltd.
> > 176, Ground Floor, 6th Main,
> > 2nd Block, RT Nagar
> > Bangalore - 560032
> > Phone : 91 80 3431470
> > www.diffs-india.com
> >
>
> --
> Jeff Beard
> ___________________________________
> Web:        www.cyberxape.com
> Location:   Boulder, CO, USA
>
>


Re: persistent database problem

Posted by Jeff Beard <be...@cyberxape.com>.
Are using Apache::DBI and establishing a connection in
your startup.pl?

On Mon, 23 Oct 2000, Differentiated Software Solutions Pvt. Ltd wrote:

> Hi,
>     I have started with one httpd; and executed the following mod-perl program from the browser. We've configured apache to have persistent DBI
>     The idea is first time the database handle will be inactive and it will print 'INSIDE'.  From the second time onwards the database handle will be active and it will print 'OUTSIDE'.  This is working.
>     But, sometimes the 'OUTSIDE' comes from the third or fourth time only.  (that is it takes more than one attempt to become persistent) Why it is happening like this?
> Thanks
> Muthu S Ganesh
> 
> mod-perl code is here:
> 
> $rc = $dbh_pg->{Active};
> print "$$: $rc\n";
> if($rc eq '')
> {
>         print "INSIDE\n";
>         $dbh_pg = DBI->connect("dbi:Pg:dbname=adcept_smg_ctrl","postgres","postgres",{RaiseError => 1}) || die $DBI::errstr;
> }
> else
> {
>         print "OUTSIDE\n";
> }
> 
> 
> Differentiated Software Solutions Pvt. Ltd.
> 176, Ground Floor, 6th Main,
> 2nd Block, RT Nagar
> Bangalore - 560032
> Phone : 91 80 3431470
> www.diffs-india.com
> 

-- 
Jeff Beard
___________________________________
Web:        www.cyberxape.com
Location:   Boulder, CO, USA



Re: persistent database problem

Posted by "Differentiated Software Solutions Pvt. Ltd" <di...@vsnl.com>.
Hi,

To avoid this problem, we specifically started only one httpd.

Murali

Differentiated Software Solutions Pvt. Ltd.
176, Ground Floor, 6th Main,
2nd Block, RT Nagar
Bangalore - 560032
Phone : 91 80 3431470
www.diffs-india.com
----- Original Message -----
From: John K. Sterling <st...@covalent.net>
To: Differentiated Software Solutions Pvt. Ltd <di...@vsnl.com>
Cc: <mo...@apache.org>
Sent: Monday, October 23, 2000 1:35 PM
Subject: Re: persistent database problem


>
> The db connection happens once for each child - so every time you hit a
> child for the first time it will open up a new connection - you probably
> have apache configured to start with 4 or so kids.
>
> sterling
>
>  On Mon, 23 Oct 2000,
> Differentiated Software Solutions Pvt. Ltd wrote:
>
> > Hi,
> >     I have started with one httpd; and executed the following mod-perl
program from the browser. We've configured apache to have persistent DBI
> >     The idea is first time the database handle will be inactive and it
will print 'INSIDE'.  From the second time onwards the database handle will
be active and it will print 'OUTSIDE'.  This is working.
> >     But, sometimes the 'OUTSIDE' comes from the third or fourth time
only.  (that is it takes more than one attempt to become persistent) Why it
is happening like this?
> > Thanks
> > Muthu S Ganesh
> >
> > mod-perl code is here:
> >
> > $rc = $dbh_pg->{Active};
> > print "$$: $rc\n";
> > if($rc eq '')
> > {
> >         print "INSIDE\n";
> >         $dbh_pg =
DBI->connect("dbi:Pg:dbname=adcept_smg_ctrl","postgres","postgres",{RaiseErr
or => 1}) || die $DBI::errstr;
> > }
> > else
> > {
> >         print "OUTSIDE\n";
> > }
> >
> >
> > Differentiated Software Solutions Pvt. Ltd.
> > 176, Ground Floor, 6th Main,
> > 2nd Block, RT Nagar
> > Bangalore - 560032
> > Phone : 91 80 3431470
> > www.diffs-india.com
> >
>


Re: persistent database problem

Posted by "John K. Sterling" <st...@covalent.net>.
The db connection happens once for each child - so every time you hit a
child for the first time it will open up a new connection - you probably
have apache configured to start with 4 or so kids.

sterling

 On Mon, 23 Oct 2000,
Differentiated Software Solutions Pvt. Ltd wrote:

> Hi,
>     I have started with one httpd; and executed the following mod-perl program from the browser. We've configured apache to have persistent DBI
>     The idea is first time the database handle will be inactive and it will print 'INSIDE'.  From the second time onwards the database handle will be active and it will print 'OUTSIDE'.  This is working.
>     But, sometimes the 'OUTSIDE' comes from the third or fourth time only.  (that is it takes more than one attempt to become persistent) Why it is happening like this?
> Thanks
> Muthu S Ganesh
> 
> mod-perl code is here:
> 
> $rc = $dbh_pg->{Active};
> print "$$: $rc\n";
> if($rc eq '')
> {
>         print "INSIDE\n";
>         $dbh_pg = DBI->connect("dbi:Pg:dbname=adcept_smg_ctrl","postgres","postgres",{RaiseError => 1}) || die $DBI::errstr;
> }
> else
> {
>         print "OUTSIDE\n";
> }
> 
> 
> Differentiated Software Solutions Pvt. Ltd.
> 176, Ground Floor, 6th Main,
> 2nd Block, RT Nagar
> Bangalore - 560032
> Phone : 91 80 3431470
> www.diffs-india.com
>