Issuing rollback() for database handle being DESTROY'd without explicit disconnect().
Why am I getting this ?? Issuing rollback() for database handle being DESTROY'd without explicit disconnect(). the code #!/usr/bin/perl # Script to maintain KBHD Stats # # Version 1.0 # # date : 6 Jun 01# # require "subparseform.lib"; # &Parse_Form; ### # Start Writing the Page # ### open(LOG,">/var/www/html/kbhd/stats.php"); print LOG "\n"; print LOG " Stats for Techs \n"; print LOG "\n"; print LOG "\n"; print LOG "\n"; print LOG " Stats Page\n"; print LOG " \n"; print LOG "\n"; # ## # get stats ## use DBI; my $database = "VHD"; my $data_source = "DBI:mysql:$database"; my $username = "user"; my $password = "password"; $dbh =DBI ->connect($data_source, $username, $password); my $sth1 = $dbh -> prepare("select count(*)from jobs where status = 'closed'"); $sth1 -> execute or die " unable to execute query "; my $array_ref = $sth1 -> fetchall_arrayref(); foreach $row(@$array_ref){ my($closedJ) = @$row; } print LOG " "; print LOG " Overall Stats"; print LOG "\n"; print LOG " \n"; print LOG " \n"; print LOG "\n"; print LOG ""; print LOG "Number Of "; print LOG "Closed Jobs : "; print LOG "\n"; print LOG "$closedJ \n"; print LOG "Total Time\n"; print LOG "Average time per Call\n"; print LOG " \n"; print LOG "\n"; print LOG "\n"; print LOG "Grades for techs \n"; ### #Query techs names# ### use DBI; my $database = "VHD"; my $data_source = "DBI:mysql:$database"; my $username = ""; my $password = ""; $dbh =DBI ->connect($data_source, $username, $password); my $sth1 = $dbh -> prepare("select username from tech1"); $sth1 -> execute or die " unable to execute query "; my $array_ref = $sth1 -> fetchall_arrayref(); foreach $row(@$array_ref){ my($tech) =@$row <mailto:=@$row> ; print LOG " $tech \n"; print LOG " \n"; print LOG "\n"; print LOG " Total Jobs Completed\n"; print LOG " \n "; print LOG " 53< /b>\n"; print LOG "\n"; print LOG " \n"; print LOG " Total Hours Spent < /td>\n"; print LOG " \n"; print LOG " 56\n"; print LOG "\n"; print LOG "\n"; print LOG " \n"; print LOG " \n"; print LOG " \n"; print LOG "\n"; print LOG "\n"; print LOG " Average time to"; print LOG "Complete \n"; print LOG " \n"; print LOG " 67\n"; print LOG "\n"; print LOG " \n"; print LOG "\n"; } close(LOG);
Re: Issuing rollback() for database handle being DESTROY'd without explicit disconnect().
I saw no $dbi->disconnect; statement in your code. If you do not disconnect, and the program ends, you will get the above message brent "FLAHERTY, JIM-CONT" To: "Beginners (E-mail)" <[EMAIL PROTECTED]> Subject: Issuing rollback() for database handle being DESTROY'd without ex plicit 06/11/01 09:00 AM disconnect(). Why am I getting this ?? Issuing rollback() for database handle being DESTROY'd without explicit disconnect(). the code #!/usr/bin/perl # Script to maintain KBHD Stats # # Version 1.0 # # date : 6 Jun 01# # require "subparseform.lib"; # &Parse_Form; ### # Start Writing the Page # ### open(LOG,">/var/www/html/kbhd/stats.php"); print LOG "\n"; print LOG " Stats for Techs \n"; print LOG "\n"; print LOG "\n"; print LOG "\n"; print LOG " Stats Page\n"; print LOG " \n"; print LOG "\n"; # ## # get stats ## use DBI; my $database = "VHD"; my $data_source = "DBI:mysql:$database"; my $username = "user"; my $password = "password"; $dbh =DBI ->connect($data_source, $username, $password); my $sth1 = $dbh -> prepare("select count(*)from jobs where status = 'closed'"); $sth1 -> execute or die " unable to execute query "; my $array_ref = $sth1 -> fetchall_arrayref(); foreach $row(@$array_ref){ my($closedJ) = @$row; } print LOG " "; print LOG " Overall Stats"; print LOG "\n"; print LOG " \n"; print LOG " \n"; print LOG "\n"; print LOG ""; print LOG "Number Of "; print LOG "Closed Jobs : "; print LOG "\n"; print LOG "$closedJ \n"; print LOG "Total Time\n"; print LOG "Average time per Call\n"; print LOG " \n"; print LOG "\n"; print LOG "\n"; print LOG "Grades for techs \n"; ### #Query techs names# ### use DBI; my $database = "VHD"; my $data_source = "DBI:mysql:$database"; my $username = ""; my $password = ""; $dbh =DBI ->connect($data_source, $username, $password); my $sth1 = $dbh -> prepare("select username from tech1"); $sth1 -> execute or die " unable to execute query "; my $array_ref = $sth1 -> fetchall_arrayref(); foreach $row(@$array_ref){ my($tech) =@$row <mailto:=@$row> ; print LOG " $tech \n"; print LOG " \n"; print LOG "\n"; print LOG " Total Jobs Completed\n"; print LOG " \n "; print LOG " 53< /b>\n"; print LOG "\n"; print LOG " \n"; print LOG " Total Hours Spent < /td>\n"; print LOG " \n"; print LOG " 56\n"; print LOG "\n"; print LOG "\n"; print LOG " \n"; print LOG " \n"; print LOG " \n"; print LOG "\n"; print LOG "\n"; print LOG " Average time to"; print LOG "Complete \n"; print LOG " \n"; print LOG " 67\n"; print LOG "\n"; print LOG " \n"; print LOG "\n"; } close(LOG);
RE: Issuing rollback() for database handle being DESTROY'd without explicit disconnect().
Actually, you disconnect your database handle...in this case: $dbh->disconnect; but that's not what I see in your script. What I see happening in your script is that you are connecting twice using the same database handle without ever disconnecting the database handle the first time. There should be no reason to connect to the same database a second time in this script unless you are using the results from the statement handle in the first database handle in the query in the second database handle. In this case, you aren't, so take out the second connection string, and you should get rid of this error. The disconnect error should not occur even if you do not explicitly disconnect from the database before the end of the script - unless you have uncommitted transactions (unlikely if you are using MySQL). If you ever need to use the results of the first query in a second query before finishing with the first statement handle, simply use a different database handle, and statement handle for the second one: ex: $dbh1, and $sth2. or $Mysql_Database and $insert...or whatever makes sense to you to use$dbh, and $sth are only examples of database and statement handles. You can use whatever makes sense in your program. Hope this helps. Steve Howard -Original Message- From: Brent Michalski [mailto:[EMAIL PROTECTED]] Sent: Monday, June 11, 2001 9:02 AM To: FLAHERTY, JIM-CONT Cc: Beginners (E-mail) Subject: Re: Issuing rollback() for database handle being DESTROY'd without explicit disconnect(). I saw no $dbi->disconnect; statement in your code. If you do not disconnect, and the program ends, you will get the above message brent "FLAHERTY, JIM-CONT" To: "Beginners (E-mail)" <[EMAIL PROTECTED]> Subject: Issuing rollback() for database handle being DESTROY'd without ex plicit 06/11/01 09:00 AM disconnect(). Why am I getting this ?? Issuing rollback() for database handle being DESTROY'd without explicit disconnect(). the code #!/usr/bin/perl # Script to maintain KBHD Stats # # Version 1.0 # # date : 6 Jun 01# # require "subparseform.lib"; # &Parse_Form; ### # Start Writing the Page # ### open(LOG,">/var/www/html/kbhd/stats.php"); print LOG "\n"; print LOG " Stats for Techs \n"; print LOG "\n"; print LOG "\n"; print LOG "\n"; print LOG " Stats Page\n"; print LOG " \n"; print LOG "\n"; # ## # get stats ## use DBI; my $database = "VHD"; my $data_source = "DBI:mysql:$database"; my $username = "user"; my $password = "password"; $dbh =DBI ->connect($data_source, $username, $password); my $sth1 = $dbh -> prepare("select count(*)from jobs where status = 'closed'"); $sth1 -> execute or die " unable to execute query "; my $array_ref = $sth1 -> fetchall_arrayref(); foreach $row(@$array_ref){ my($closedJ) = @$row; } print LOG " "; print LOG " Overall Stats"; print LOG "\n"; print LOG " \n"; print LOG " \n"; print LOG "\n"; print LOG ""; print LOG "Number Of "; print LOG "Closed Jobs : "; print LOG "\n"; print LOG "$closedJ \n"; print LOG "Total Time\n"; print LOG "Average time per Call\n"; print LOG " \n"; print LOG "\n"; print LOG "\n"; print LOG "Grades for techs \n"; ### #Query techs names# ### use DBI; my $database = "VHD"; my $data_source = "DBI:mysql:$database"; my $username = ""; my $password = ""; $dbh =DBI ->connect($data_source, $username, $password); my $sth1 = $dbh -> prepare("select username from tech1"); $sth1 -> execute or die " unable to execute query "; my $array_ref = $sth1 -> fetchall_arrayref(); foreach $row(@$array_ref){ my($tech) =@$row <mailto:=@$row> ; print LOG " $tech \n"; print LOG " \n"; print LOG "\n"; print LOG " Total Jobs Completed\n"; print LOG " \n "; print LOG " 53< /b>\n"; print LOG "\n"; print LOG " \n"; print LOG " Total Hours Spent < /td>\n"; print LOG " \n"; print LOG " 56\n"; print LOG "\n"; print LOG "\n"; print LOG " \n"; print LOG " \n"; print LOG " \n"; print LOG "\n"; print LOG "\n"; print LOG " Average time to"; print LOG "Complete \n"; print LOG " \n"; print LOG " 67\n"; print LOG "\n"; print LOG " \n"; print LOG "\n"; } close(LOG);