Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

PER DBI gives selectrow_array error

by tellblom (Initiate)
on Jan 11, 2013 at 09:44 UTC ( #1012847=perlquestion: print w/replies, xml ) Need Help??
tellblom has asked for the wisdom of the Perl Monks concerning the following question:

Hi all wise people, I have a script that running check against Micrososft SQL servers to check for failed maint jobs.

This script works on 34 diffrent SQL servers (2000,2005, 2008 and 2008R2) But now I got one where I get the error: "Can't call method "selectrow_array" on an undefined value at (and the row number in the script).

Is it something I have forgotten to do in the SQL server (it's a SQL 2005SP2)? The script works very well on other SQL 2005 SP2 servers.

Can someone Point me in the right direction whats missing on the SQL server?

Replies are listed 'Best First'.
Re: PER DBI gives selectrow_array error
by Anonymous Monk on Jan 11, 2013 at 09:54 UTC

    You're not error checking properly and have turned off RaiseError

    my $sth = $dbh->prepare ...
    can fail, with RaiseError it will die, but without RaiseError it won't die (stop your program)

    So either use  if( my $sth = $dbh->... ) or turn on RaiseError and let it die, or catch it with eval or do whatever

Re: PER DBI gives selectrow_array error
by Anonymous Monk on Jan 11, 2013 at 09:56 UTC
    I'm guessing you are failing to connect to the server, and as such the DBI object stays undef. You did remember to die when connecting, didn't you?
      Its a nagios check from the beginning and it seems like it works all over the World. Its just with this server. Could it be a timeout error?


        It could be a timeout error, a firewall error, database driver configuration error, or many other things. If you check your opens and prepare statements for errors and print the error message(s), you'll narrow things down a good bit.


        When your only tool is a hammer, all problems look like your thumb.

        Can you connect to the service on this problematic target server using another tool on the server on which the script is failing? Have you enabled error checking/debugging/tracing to find out what's failing?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1012847]
Approved by Corion
[ambrus]: "you are far more likely to be squished between two other dudes" => wait, really? aren't most planes, weighted by people traveling on it, so narrow that there are only two or three seats on each side of the one corridor, so only one third of the people ge
[ambrus]: t squished between two other people?
holli is about to take the first hit since a month and this weed is strong shit. Should my head explode, someone call 911.
[ambrus]: And even when I traveled on a big plane for a long flight, it had 3 seats, then corridor, then 4 seats, then corridor, then 3 seats, so less than half of the people sit between two other dudes.
[1nickt]: you are missing an entire element, which is that your base ticket price only gets you a middle seat. If you want to be window or aisle you must pay, or gamble that you'll be assigned there at ...
[1nickt]: ... flihght time (hoping that not enough others have paid and there are some "good" seats to be allotted.
[1nickt]: And this is in addition to paying extra if you want to be in the first 12 rows, or in the emergency exit row.

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (12)
As of 2017-12-18 13:42 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (486 votes). Check out past polls.