Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am using DBI,
when I close the statement handle, my program hangs.
If I leave it the way it is, it finishes but complains
about the open statement handle $dtcursor
I am connected to SYBASE and to SQL.
my($daysql) = "select convert(char(8),getdate(),112),convert(char(8,dateadd(month, +1,getdate())),112)";<br> my($dtcursor)=$scb_db->prepare($daysql);<br> $dtcursor->execute;<br> my($ddate,$nextddate)=$dtcursor->fetchrow_array;<br> my($day) = substr($ddate,6,2);<br> print STDOUT "$ddate,$nextddate,$day\n";<br> close (OUT); #files that I opened at start of program<br> close (ERROR);<br> ###################################################################### +##################### ###################################################################### +################## print STDOUT "Normal Exit\n";<br> $apex_db->disconnect;<br die "Error disconnecting from database: <br>$DBI::err $D +BI::errstr\n" if $DBI::err ;<br> $scb_db->disconnect;<br> die "Error disconnecting from database: <br>$DBI::err $D +BI::errstr\n" if $DBI::err ;<br> exit (0);<br>

Replies are listed 'Best First'.
Re: close of statement handle causes hang
by almut (Canon) on Jun 05, 2008 at 19:54 UTC

    You could try calling finish on your $dtcursor statement handle. In most cases this is not needed, but here you could probably get rid of the warning this way.  Not sure if it will help with the program hanging, though...