6 messages in com.mysql.lists.perlRe: Problems connecting
FromSent OnAttachments
Albert E. Whale20 Jul 2006 13:33 
Martin J. Evans20 Jul 2006 14:09 
A. Gerow20 Jul 2006 14:40 
Martin J. Evans20 Jul 2006 14:48 
Albert E. Whale20 Jul 2006 15:47 
Martin J. Evans21 Jul 2006 02:36 
Subject:Re: Problems connecting
From:Martin J. Evans (mart@easysoft.com)
Date:07/21/2006 02:36:05 AM
List:com.mysql.lists.perl

Aaron,

Appologies, I mistook you for the original poster.

Martin

On Thu, 2006-07-20 at 14:40 -0700, A. Gerow wrote:

I'm pretty sure one can fetch only the first couple rows in a return-set and still be ok. The general idea is: $dbh-> connect(...)

$sth=$dbh->prepare(sql_stmt) $sth->execute() $sth->fetch() # different for different kinds of returns. $sth->finish() # Are you missing this? ...

$dbh->disconnect() # Your error.

But the error indicates you are not calling finish.

You never said you were calling finish AND getting the error.

As far as I am aware you WILL get this error it you do not call finish and have not fetched all the results.

The error "disconnect invalidates 1 active statement handle" implies you have an active statement for which all results have not been fetched when you call disconnect. e.g.

prepare(some sql) execute fetch one row when there are 20 rows

Right here one should call $sth->finish()

disconnect (or script terminates)

As the error states, if you don't fetch all the results from a select then call finish first or fetch all the results.

I cannot tell from your description how "this works on one server" and not another.