Hi all,

Software (Apache 2.2.4, mpm prefork / 8 children, mp 2.0.3, Apache::DBI 1.06)

On Apache startup i am loading a module via "startup.pl", which establishes
a database (mysql) connection:

[..]
package SomeModule;
..
sub new {
   my $this = shift;
   my $class = ref($this) || $this;
   my $self = {};
   bless $self, $class;

$self->{'dbh'} = DBI->connect ("DBI:mysql:somedb:localhost", "root", "", {RaiseError => 1}); return $self;
}
my $object = HZLabs::DBInit->new ();
[..]

"$object" lives until the server is killed again.

startup.pl:

[..]
use Apache::DBI;
use DBI;
use SomeModule;
[..]


While running the server there is only one apache - mysql connection visible via "mysqladmin processlist" and not one connection for each apache child process
as usually.

I have found no irregularities, but this statement in the Apache::DBI manpage makes me
worried:

"...Also it is not possible to create a database handle upon startup of the httpd and then inheriting this handle to every subsequent server. This will
cause clashes when the handle is used by two processes at the same time. .."


Questions:

Do i have to expect problems, when there will be more traffic on the server leading to a situation where this connection will be used by more than one process at the "same time"?

Is the mysql_function "last_insert_id()" still working correct in this situation?

Thanks

Helmut







Reply via email to