in reply to Re^2: Strange Execute Issue from PERL
in thread Strange Execute Issue from PERL

You currently have:

$rv = $sth->execute or die "can't execute the query: $sth->errstr";

I suggest that you change it into

$rv = $sth->execute or die "can't execute the query: " . $sth->errstr;

... so that you see the actual error message from your database driver.

If you look at the error message you got until now, you see DBI:: st=HASH(0x1a07924)-> errstr in there, which is much less informative than the actual return value of ->errstr.

Replies are listed 'Best First'.
Re^4: Strange Execute Issue from PERL
by LHowell (Initiate) on May 07, 2011 at 23:33 UTC
    I made the change as follows: $sth = $dbh->prepare($InsertIntoMetar) or die "can't execute the query: " . $sth->errstr; I got the same result as before! I'm thinking that this has to be do some "user" or "pass" issue but that doesn't seem possible since I "prepare" and "execute make statements against tables in this database in the same script prior to the one that is causing me trouble. I create tables "Like" metar numerous times and do many "alters" and "drops". This is the first time I actually try to update "metar" though! Hope this helps! I am sure this is going to turn out to be something that is going to make me look VERY silly! Thoughts?

      I'm sorry. I quickly edited my node after posting it. First I had the ->prepare statement, but I then changed it to the ->execute statement. Please do make that change as well to your code.

      As general advice, I feel that two points might improve the quality of responses you get from us:

      First, please do take the time to learn how to format your nodes properly and how to mark text and code. It will make your nodes much more readable than the wall of text they currently appear as.

      Second, you might want to try to understand what I'm doing and suggesting here, and try to apply these changes to other parts of your code yourself. Retrieving as much information about the error case as possible is important before trying to remedy the error cause. Your descriptions about what you do don't seem to relate to the error cause at all. You haven't told us what database you are using, you haven't shown a self-contained program that replicates the problem. It seems to me that you don't know much about the code you are running. This is not a problem per se, but it means that you will need to familiarize yourself with the code much more before guessing about where the problems lie and what causes them. If you take more care to eliminate the non-Perl issues like database permissions, and put some effort into presenting a self-contained case, you will find that people are far more likely to try it and to give you answers relevant to your problem.

        Please understand. I have read your reply and will certainly read the releavant documents pertaining to mark up, prior to sending any additional information. You are quite correct in seeing that I am not a Perl Professional. What you need to know is that I wrote the entire application from scratch myself with self taught Perl. I had many stumbling blocks and was able to get over these by help from the internet at large. I DO know the code I am running, while I will be the first to admit, that alot of what I am doing I do NOT completely understand. I have been programming for over 40 years in everything from assembly language to 4GL languages. I am a recognized expert on SAS and have been on numerous panels. I have held director level software development positions. I mention these only because of your challenging my expertise. I truly need assistance with Perl in its intraciacy going foreward and I thought I had stumbled on a great site, but I guess you have to be born knowing everything before you can dare to ask for help. I have alot to give and only asked for help. I apologize for any mis-appropriations of your time but I will be monitoring the site to see where I can be of assistance, mostly in SAS, but I have written alot of Perl hands off automation processes using Oracle. By the way, you are right, again, I did not mention the database I am using, it is MYSQL. Thanks for your time.