Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: perl DBI help

by George_Sherston (Vicar)
on Sep 26, 2002 at 20:49 UTC ( #201050=note: print w/ replies, xml ) Need Help??


in reply to perl DBI help

That error message is telling you that you can't fetch something from $sth because it didn't execute properly. What that means is that the trouble actually started earlier, and probably surfaced somewhere in either of these lines:

$sth = $dbh->prepare ($stmt); $sth->execute();
On the face of it I can't see anything wrong with your code (though other monks may be able to). My guess is something like a typo in $stmt. The easy way to find out is to edit those lines to
$sth = $dbh->prepare ($stmt) or die $dbh->errstr; $sth->execute() or die $dbh->errstr;
That may well throw some light on exactly where it's breaking down, by giving you some informative error messages. (NB if it dies on the first of these and doesn't give you an informative error message, that probably means your DB handle didn't get properly initialised in the first place - password prob?)

George Sherston


Comment on Re: perl DBI help
Select or Download Code
Re: Re: perl DBI help
by swiftone (Curate) on Sep 26, 2002 at 20:54 UTC
    Actually, the RaiseError => 1 in his connect routine has this exact effect. (You may want to then wrap your calls in eval, but the die-ing has been accomplished.)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://201050]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2014-09-01 14:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (13 votes), past polls