Hello all,

I really hope some kind soul out there can help me with this problem!

I'm using Perl dbi:Pg (as well as DBIx::Recordet) in a CGI script where
the users connect to my database through the web. The problem is that the
database connections won't close down and I end up with an increasing
number of these when 'ps-ef|grep postgres':

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]

After a while they exceed the default number of connections(32) and I get
a Software error message.

This is parts of the script I'm using:
...
$db = DBIx::Database->new({'!DataSource' => 'dbi:Pg:dbname=testdb',
                           '!Username' => 'apache',
                           '!KeepOpen' => 1}) ;
...
*set = DBIx::Recordset->Search('!DataSource' => $db, 
                               '!Table' => $table,
                               '!Fields' => $joined_col,
                               '$where' => $query);
...
$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

Reply via email to