Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2018-04-25 05:44 GMT
Find Nodes?
    Voting Booth?