expresspotato has asked for the wisdom of the Perl Monks concerning the following question:
Hey,
$dbh->disconnect; For some reason isn't working for me... Take the following example:
It will print the number of mysql connections before and after the script is run. Continually running it you can see the number active connections increases with each run. The connections do eventually time out but that's no help at all. Considering a server could try and handle thousands of requests, without them being disconnected (on demand) the server would quickly grind to a halt. Any help would be appreciated! -Kevinuse DBI; #do("./sql.pl"); print `netstat | grep "mysql" | wc -l`; $db="billing"; $user="user"; $passwd="me"; $host="localhost:3306"; $connectionInfo="dbi:mysql:$db;$host"; $select = "select id from sometable;"; $dbh=DBI->connect($connectionInfo,$user,$passwd) || print "DBI Conne +ction Failed!($DBI::errstr)"; $sth=$dbh->prepare($select); if (!($sth->execute())) { } @row=$sth->fetchrow_array(); $sth->finish; $dbh->disconnect; print `netstat | grep "mysql" | wc -l`;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: DBI Disconnect does nothing!
by Anonymous Monk on Jun 08, 2009 at 09:20 UTC | |
Re: DBI Disconnect does nothing!
by dHarry (Abbot) on Jun 08, 2009 at 09:21 UTC | |
by Anneq (Vicar) on Jun 08, 2009 at 12:55 UTC | |
by Anonymous Monk on Jun 08, 2009 at 15:07 UTC | |
by Anneq (Vicar) on Jun 08, 2009 at 17:59 UTC | |
by jethro (Monsignor) on Jun 10, 2009 at 09:01 UTC | |
Re: DBI Disconnect does nothing!
by mje (Curate) on Jun 08, 2009 at 09:22 UTC | |
Re: DBI Disconnect does nothing!
by arc_of_descent (Hermit) on Jun 09, 2009 at 06:41 UTC | |
Re: DBI Disconnect does nothing!
by Anonymous Monk on Jun 08, 2009 at 21:39 UTC | |
by mje (Curate) on Jun 09, 2009 at 07:17 UTC |
Back to
Seekers of Perl Wisdom