List:General Discussion« Previous MessageNext Message »
From:Fred Read Date:April 6 1999 9:05am
Subject:Re: Database handle destroyed without explicit disconnect
View as plain text  
Jonathan A. Zdziarski wrote:
> ...
> yet I'm getting the error 'Database handle destroyed without 
> explicit disconnect' at the point where each child does a connect. 
> I'm using a lexical $DBH variable (perl obviously) i don't believe 
> it would be shared by all the processes, as it comes after the fork.  
> ...

I'm not a perl expert but had exactly the same error the very 
first time I played with DBI.

My problem was caused by opening the connection in a function
and using a local variable to hold the connection handle. 
Although the function returned the handle [or so I thought] to 
the calling function the perl garbage collector was destroying 
the handle as soon as the variable name went out of scope [at 
function exit].

My solution was to return a reference to the database handle 
instead which solved my problem.

Hope this helps...
-- 

If it ain't opinionated, it ain't Rich Teer.
Thread
Database handle destroyed without explicit disconnectJonathan A. Zdziarski30 Mar
  • Re: Database handle destroyed without explicit disconnectFred Read6 Apr