Re: DBI connections build up..

2001-09-14 Thread Perrin Harkins

  Your script uses an END block to disconnect.  If you use
  Apache::Registry, that will not be run until the server is shut down.
  With Apache::DBI, you should get one connection per Apache process, and
  they'll stay open.  If you are changing the login parameters (i.e.
  different user each time), you can't use Apache::DBI because you'll get
  a huge build-up of connections.

 really? when did that change? As much as I know, Apache::Registry scripts
 always run END blocks.
 http://perl.apache.org/guide/porting.html#END_blocks

Right, my mistake.  I was thinking about BEGIN blocks and Registry vs.
PerlRun.
- Perrin




Re: DBI connections build up..

2001-09-14 Thread Perrin Harkins

  Your script uses an END block to disconnect.  If you use
  Apache::Registry, that will not be run until the server is shut down.
  With Apache::DBI, you should get one connection per Apache process, and
  they'll stay open.  If you are changing the login parameters (i.e.
  different user each time), you can't use Apache::DBI because you'll get
  a huge build-up of connections.

 really? when did that change? As much as I know, Apache::Registry scripts
 always run END blocks.
 http://perl.apache.org/guide/porting.html#END_blocks

Right, my mistake.  I was thinking about BEGIN blocks and Registry vs.
PerlRun.
- Perrin




Re: DBI connections build up..

2001-09-13 Thread Jeff Beard



On Thu, 13 Sep 2001, DJ (David J Radunz) wrote:

 use strict;
 use vars ($dbh);

You don't need this with Apache::DBI. Globals in general should be
avoided/used with extreme caution.

 use mod_perl;

Don't need this either.

 1;

 END {
 $dbh-disconnect;
 }

Put this before the '1;' or just don't use it.

Read the guide front to back: http://perl.apache.org/guide/

HTH.

Jeff


--
Jeff Beard
___
Web:www.cyberxape.com
Email:  jeff at cyberxape dot com
Earth:  Boulder, CO, USA




Re: DBI connections build up..

2001-09-13 Thread Ged Haywood

Hi there,

On Thu, 13 Sep 2001, DJ (David J Radunz) wrote:

 the database connections just keep building up. 

Read the database section of the Guide:

http://perl.apache.org/guide

73,
Ged.




Re: DBI connections build up..

2001-09-13 Thread Perrin Harkins

 DJ (David J Radunz) wrote:
 I am having a problem with a module im writing connecting to the
 database everytime its run, and not cleaning up the database
 connection when its finished.

Your script uses an END block to disconnect.  If you use
Apache::Registry, that will not be run until the server is shut down. 
With Apache::DBI, you should get one connection per Apache process, and
they'll stay open.  If you are changing the login parameters (i.e.
different user each time), you can't use Apache::DBI because you'll get
a huge build-up of connections.

- Perrin