Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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?

Comment on PER DBI gives selectrow_array error
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?

        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?

        tellblom:

        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.

        ...roboticus

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2014-08-01 04:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (256 votes), past polls