Обсуждение: Why doesn't my PerlCGI users postgres connections close down?
Why doesn't my PerlCGI users postgres connections close down?
От
m.claesson@student.ucc.ie (Marcus Claesson)
Дата:
Hi, I still have the default max number of database connections (32), but instead of increasing it I want the connections to be closed down after being used. I get an increasing number of these: postgres 22906 695 0 13:40 ? 00:00:00 postgres: apache testdb [local] postgres 22913 695 0 13:41 ? 00:00:00 postgres: apache testdb [local] postgres 22926 695 0 13:47 ? 00:00:00 postgres: apache testdb [local] postgres 22933 695 0 13:59 ? 00:00:00 postgres: apache testdb [local] p And I'm using Perl dbi:Pg (as well as DBIx::Recordset) in a CGI script, and in the end I try to close the connection: $db = DBIx::Database->new({'!DataSource' => 'dbi:Pg:dbname=testdb', '!Username' => 'apache', '!KeepOpen' => 1}) or die "Couldn't connect to database"; ... *set = DBIx::Recordset->Search({%fdat,('!DataSource' => $db, '!Table' => $table, '!Fields' => $joined_col, '$where' => $query)}) or die "Couldn't connect to table :$DBI::errstr "; ... $set -> Disconnect (); Although this doesn't close any connection and they accumulate in a way I don't want them to. If I set '!KeepOpen' to 0 I can't run the script since $db isn't recognized later on. Really gratefull for any help! Regards, Marcus