From joseph@sitewarehouse.net Tue Dec 19 19:44:52 2000 Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id eBJJiq612283 for ; Tue, 19 Dec 2000 14:44:52 -0500 (EST) (envelope-from pgsql-admin-owner@postgresql.org) Received: from sitewarehouse1.sitewarehouse.net ([204.138.56.2]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBJIt1607290; Tue, 19 Dec 2000 13:55:01 -0500 (EST) (envelope-from joseph@sitewarehouse.net) Received: from swnt3 (H163.C59.tor.velocet.net [204.138.59.163]) by sitewarehouse1.sitewarehouse.net (8.9.3/8.9.3) with SMTP id NAA22998; Tue, 19 Dec 2000 13:54:59 -0500 Message-ID: <000801c069ed$68ef1b00$a33b8acc@sitedom> From: "Joseph" To: , , Cc: , Subject: Help me for "DBI->connect failed: Sorry, too many clients already." Date: Tue, 19 Dec 2000 13:56:33 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0005_01C069C3.7F186BE0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Archive-Number: 200012/122 X-Sequence-Number: 318 This is a multi-part message in MIME format. ------=_NextPart_000_0005_01C069C3.7F186BE0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable my cgi program is test.cgi: ####################### require "./connectdb.pl"; &connectdatabase(); $query=3D"select count(*) from messages"; $sth=3D$dbh->prepare($query); $sth->execute(); $count=3D$sth->fetchrow_array(); print "Content-type: text/html\n\n"; print <<"TAG";

The count is $count.

TAG exit 0; ############# my connectdb.pl : sub connectdatabase { # my ($dbusername,$dbpassword)=3D@_; $dbusername=3D"postgres"; $dbpassword=3D"lokicom"; $dbname=3D"mboardsony"; use DBI; $dbh=3DDBI->connect("dbi:Pg:dbname=3D$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 messag= e: "DBI->connect failed: Sorry, too many clients already." Who can help me? Thank you ahead. =20=20 My email: joel_xue@hotmail.com ------=_NextPart_000_0005_01C069C3.7F186BE0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
my cgi program is=20 test.cgi:
#######################
require=20 "./connectdb.pl";
&connectdatabase();
$query=3D"select count(*) f= rom=20 messages";
$sth=3D$dbh->prepare($query);
$sth->execute();
$c= ount=3D$sth->fetchrow_array();
print=20 "Content-type: text/html\n\n";
print=20 <<"TAG";
<html>
<body>
<h2> The count is= =20 $count. </h2>
</body>
</html>
TAG
exit=20 0;
#############
my connectdb.pl :
sub connectdatabase {
# = ; my=20 ($dbusername,$dbpassword)=3D@_;
  $dbusername=3D"postgres";
&nbs= p;=20 $dbpassword=3D"lokicom";
  $dbname=3D"mboardsony";
  use=20 DBI;
 =20 $dbh=3DDBI->connect("dbi:Pg:dbname=3D$dbname",$dbusername,$dbpassword) o= r die=20 "can
not connect to $dbname\n";
}
1;
#######################my=20 os is Redhat 6.2,and perl 5.005,and  web server is Apache.
The prob= lem=20 is:when I run test.cgi,it can work properly.But when I press F5
to refre= sh=20 the web page for sever minutes,the Apache will have error=20 message:
"DBI->connect failed: Sorry, too many clients already."
&= nbsp;=20 Who can help me?
  Thank you ahead.
 
  My email: = joel_xue@hotmail.com
<= /BODY> ------=_NextPart_000_0005_01C069C3.7F186BE0-- From schaefer@alphanet.ch Tue Dec 19 20:10:24 2000 Received: from vulcan.alphanet.ch (sitebco-home-5-17.urbanet.ch [194.38.85.209]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBJKAN615834 for ; Tue, 19 Dec 2000 15:10:24 -0500 (EST) (envelope-from schaefer@alphanet.ch) Received: from defian (root@localhost) by vulcan.alphanet.ch (8.9.3/8.9.3) with bsmtp id VAA00191; Tue, 19 Dec 2000 21:10:02 +0100 Received: from localhost (schaefer@localhost) by defian.alphanet.ch (8.9.3/8.9.3/Debian 8.9.3-21) with SMTP id VAA00990; Tue, 19 Dec 2000 21:02:48 +0100 Date: Tue, 19 Dec 2000 21:02:47 +0100 (MET) From: Marc SCHAEFER To: Joseph cc: pgsql-general@postgresql.org Subject: Re: Help me for "DBI->connect failed: Sorry, too many clients already." In-Reply-To: <000801c069ed$68ef1b00$a33b8acc@sitedom> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200012/613 X-Sequence-Number: 1895 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. From jliang@jliang.ipinc.com Wed Dec 20 17:44:12 2000 Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id eBKHiC697365 for ; Wed, 20 Dec 2000 12:44:12 -0500 (EST) (envelope-from pgsql-admin-owner@postgresql.org) Received: from jliang.ipinc.com (jliang.ipinc.com [199.245.188.130]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBJMWp627120; Tue, 19 Dec 2000 17:32:51 -0500 (EST) (envelope-from jliang@jliang.ipinc.com) Received: from localhost (jliang@localhost) by jliang.ipinc.com (8.9.3/8.9.3) with ESMTP id OAA41554; Tue, 19 Dec 2000 14:22:34 -0800 (PST) (envelope-from jliang@jliang.ipinc.com) Date: Tue, 19 Dec 2000 14:22:34 -0800 (PST) From: Jie Liang To: Joseph cc: pgsql-hackers@postgresql.org, pgsql-interfaces@postgresql.org, pgsql-admin@postgresql.org, pgsql-general@postgresql.org Subject: Re: Help me for "DBI->connect failed: Sorry, too many clients already." In-Reply-To: <000801c069ed$68ef1b00$a33b8acc@sitedom> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200012/129 X-Sequence-Number: 325 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"; > > >

The count is $count.

> > > 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 > From schaefer@alphanet.ch Wed Dec 20 20:04:07 2000 Received: from vulcan.alphanet.ch (sitebco-home-5-17.urbanet.ch [194.38.85.209]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBKK47615457; Wed, 20 Dec 2000 15:04:07 -0500 (EST) (envelope-from schaefer@alphanet.ch) Received: from defian (root@localhost) by vulcan.alphanet.ch (8.9.3/8.9.3) with bsmtp id VAA05682; Wed, 20 Dec 2000 21:03:36 +0100 Received: from localhost (schaefer@localhost) by defian.alphanet.ch (8.9.3/8.9.3/Debian 8.9.3-21) with SMTP id UAA00646; Wed, 20 Dec 2000 20:04:51 +0100 Date: Wed, 20 Dec 2000 20:04:50 +0100 (MET) From: Marc SCHAEFER To: Jie Liang cc: Joseph , pgsql-hackers@postgresql.org, pgsql-interfaces@postgresql.org, pgsql-admin@postgresql.org, pgsql-general@postgresql.org Subject: Re: Re: [ADMIN] Help me for "DBI->connect failed: Sorry, too many clients already." In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200012/644 X-Sequence-Number: 1928 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).