my cgi program is test.cgi:
#######################
require "./connectdb.pl";
&connectdatabase();
$query="select count(*) from messages";
$sth=$dbh->prepare($query);
$sth->execute();
$count=$sth->fetchrow_array();
print "Content-type: text/html\n\n";
print <<"TAG";
<html>
<body>
<h2> The count is $count. </h2>
</body>
</html>
TAG
exit 0;
#############
my connectdb.pl :
sub connectdatabase {
#  my ($dbusername,$dbpassword)=@_;
  $dbusername="postgres";
  $dbpassword="lokicom";
  $dbname="mboardsony";
  use DBI;
  $dbh=DBI->connect("dbi:Pg:dbname=$dbname",$dbusername,$dbpassword) or die "can
not connect to $dbname\n";
}
1;
#######################
my os is Redhat 6.2,and perl 5.005,and  web server is Apache.
The problem is:when I run test.cgi,it can work properly.But when I press F5
to refresh the web page for sever minutes,the Apache will have error message:
"DBI->connect failed: Sorry, too many clients already."
  Who can help me?
  Thank you ahead.
  
  My email: joel_xue@hotmail.com







my cgi program is 
test.cgi:#######################require 
"./connectdb.pl";&connectdatabase();$query="select count(*) from 
messages";$sth=$dbh->prepare($query);$sth->execute();$count=$sth->fetchrow_array();print 
"Content-type: text/html\n\n";print 
<<"TAG";<html><body><h2> The count is 
$count. </h2></body></html>TAGexit 
0;#############my connectdb.pl :sub connectdatabase {#  my 
($dbusername,$dbpassword)=@_;  $dbusername="postgres";  
$dbpassword="lokicom";  $dbname="mboardsony";  use 
DBI;  
$dbh=DBI->connect("dbi:Pg:dbname=$dbname",$dbusername,$dbpassword) or die 
"cannot connect to $dbname\n";}1;#######################my 
os is Redhat 6.2,and perl 5.005,and  web server is Apache.The problem 
is:when I run test.cgi,it can work properly.But when I press F5to refresh 
the web page for sever minutes,the Apache will have error 
message:"DBI->connect failed: Sorry, too many clients already."  
Who can help me?  Thank you ahead.    My email: joel_xue@hotmail.com
Tue, 19 Dec 2000 13:56:33 -0500
"Joseph" <joseph@sitewarehouse.net>
Help me for "DBI->connect failed: Sorry, too many clients already."
On Tue, 19 Dec 2000, Joseph wrote:

>   $dbh=DBI->connect("dbi:Pg:dbname=$dbname",$dbusername,$dbpassword) or die "can

I would assume that if you never disconnect and are running under
mod_perl, you will have problems.


Tue, 19 Dec 2000 21:02:47 +0100 (MET)
Marc SCHAEFER <schaefer@alphanet.ch>
Re: Help me for "DBI->connect failed: Sorry,
	too many clients already."
Hi,there,

I hope it helps;

1. postgres by default allows 16 sessiones(if I don't remember wrong)
   at same time. You can change the setting according to the doccument.
   open too many sessiones at same time will more or less affect the
   performance.
2. I believe that using Pg module will be easier than DBI.


Jie LIANG

Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.ipinc.com

On Tue, 19 Dec 2000, Joseph wrote:

> my cgi program is test.cgi:
> #######################
> require "./connectdb.pl";
> &connectdatabase();
> $query="select count(*) from messages";
> $sth=$dbh->prepare($query);
> $sth->execute();
> $count=$sth->fetchrow_array();
> print "Content-type: text/html\n\n";
> print <<"TAG";
> <html>
> <body>
> <h2> The count is $count. </h2>
> </body>
> </html>
> TAG
> exit 0;
> #############
> my connectdb.pl :
> sub connectdatabase {
> #  my ($dbusername,$dbpassword)=@_;
>   $dbusername="postgres";
>   $dbpassword="lokicom";
>   $dbname="mboardsony";
>   use DBI;
>   $dbh=DBI->connect("dbi:Pg:dbname=$dbname",$dbusername,$dbpassword) or die "can
> not connect to $dbname\n";
> }
> 1;
> #######################
> my os is Redhat 6.2,and perl 5.005,and  web server is Apache.
> The problem is:when I run test.cgi,it can work properly.But when I press F5
> to refresh the web page for sever minutes,the Apache will have error message:
> "DBI->connect failed: Sorry, too many clients already."
>   Who can help me?
>   Thank you ahead.
>   
>   My email: joel_xue@hotmail.com
> 


Tue, 19 Dec 2000 14:22:34 -0800 (PST)
Jie Liang <jliang@jliang.ipinc.com>
Re: Help me for "DBI->connect failed: Sorry, too many clients
	already."
On Tue, 19 Dec 2000, Jie Liang wrote:

> 2. I believe that using Pg module will be easier than DBI.

DBD::Pg is used by DBI, and DBI is more generic (read: portable, better,
etc).


Wed, 20 Dec 2000 20:04:50 +0100 (MET)
Marc SCHAEFER <schaefer@alphanet.ch>
Re: Re: [ADMIN] Help me for "DBI->connect failed: Sorry,
	too many clients already."