Hi, I'm trying to initiate connections in startup.pl for later use (mod_perl 1.xx):
(startup.pl): use Apache::DBI; ... Apache::DBI->connect_on_init( 'dbi:Pg:dbname=mydb;host=myhost;port=5432', 'nobody',''); Later, I am attempting to reuse these connections in an Apache::Registry script using use DBI; $dbh=DBI->connect('dbi:Pg:dbname=mydb;host=myhost;port=5432','nobody',''); Now what happens is that each Apache child opens 2 connections to this DS and presumably the one from startup.pl isn't used. The reason for this seems to be that the call from startup.pl does not set dbi_connect_method, while the second call sets it to 'Apache::DBI::connect'. The Apache::DBI::connect method reuses and caches connections based on a key that includes this (from the option hash presumably), so the keys differ for those 2 calls: first key ($Idx printed from Apache::DBI::connect): dbname=mydb;host=myhost;port=5432^\nobody^\^\AutoCommit=1^\PrintError=1^\Username=nobody second key: dbname=mydb;host=myhost;port=5432^\nobody^\^\AutoCommit=1^\PrintError=1^\Username=nobody^\dbi_connect_method=Apache::DBI::connect Can this be avoided somehow so that only 1 connection is initiated and reused? Is my DBI(1.53) or Apache::DBI(1.04) too old? Is it a bad idea to set dbi_connect_method explicitly in startup.pl? Thanks, Marinos