I got some strange error when reading MySQL, my code is something like this:
my $sql = <<"sqleof";
select t1.name t1_name, t2.name t2_name from t2
inner join t1 using(Id)
where t2.Id in (select Id from t3 where t3Id='$id')
sqleof
#here $dbh had connected correctly and done some query before this; $sql can execute pretty well on MySQL command line and return me some records.
my $execute = $dbh->prepare($sql);
$execute->execute or die "Error: $DBI::errstr\n";
my @client = $execute->fetchrow_array() or die "Error: $DBI::errstr\n";
#here I got error saying: DBD::ODBC::st fetchrow_array failed: Unable to fetch information about the error
What's the problem?
Hi, all, sorry to bother you. I had found the reason. It's a low level miss, as I had used multiple $dbh and I make a mistake of the execute name.
my $execute_A = $dbh->prepare($sql);
$execute_A->execute or die "Error: $DBI::errstr\n";
my @client = $execute_B->fetchrow_array() #$execute_B here when I copied lines and modified.
Your helps are of much importance to me. Thank you all.
mysqland error suggests you're using it with ODBC which is very unusual setup.