List:MySQL and Perl« Previous MessageNext Message »
From:Jochen Wiedmann Date:August 11 1999 8:48am
Subject:Re: Problems with ->disconnect
View as plain text  
"James W. Blackwell" wrote:
> Greetings,
> Ok, I've gotten DBI to the point where I can submit queries, get
> results, modify data, etc.  I'm surprised about that.
> Here's what's stumping me.  I always get the following message:
> Database handle destroyed without explicit disconnect.
> I try to add a $dbh->disconnect; before I exit(0); but then I get this:
> DBI::db=HASH(0x815d224)->disconnect invalidates 1 active
> statement. Either destroy statement handles or call finish on them
> before disconnecting.
> If I try a $dbh->finish; I get:
> Can't locate object method "finish" via package "DBI::db"
> I'm sure this is simple for the guru's, but I just can't figure it out.

This should be


and not


I strongly recommend to use statement handles in local scope only,
for example like this:

	    my $sth = $dbh->prepare($query);
	    # Use the handle here to read data
	# At this point the statement handle's out of scope.
	# That means, his constructor and hence $sth->finish()
	# will be called automatically.



Jochen Wiedmann						joe@stripped
Life has brown and green eyes. :-)			+49 7123 14887

Problems with ->disconnectJames W. Blackwell11 Aug
  • Re: Problems with ->disconnectJochen Wiedmann11 Aug