Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Perl Gurus: I trying to connect my perl script to a MS SQL Server from a Suse 11. I've tried using Freetds but was unsuccessful. I then tried downloading the Sybase AES ODBC libraries, but I'm not sure if just simply coping the into the Perl library will work. Below is my script. Your help will be appreciated.
#!/usr/bin/perl -w use strict; use warnings; #You might need to define parameters for the input. use DBI; use Getopt::Long qw(:config no_ignore_case); my ($status, $failed, $host, $verbose, $timeout); my $VERSION = 0.1; my $HELP = 0; # Default values $failed = 0; my %STATUSCODE = ( 'OK' => '0', 'WARNING' => '1', 'CRITICAL' => '2', 'UNKNOWN' => '3'); my $usage = <<EOF; Test EOF # handle cmdline args my $result = GetOptions( "H|host=s" => \$host, "h|help" => \$HELP,); if( !$result ) { print "ERROR: Problem with cmdline args\n"; print $usage; exit($STATUSCODE{'UNKNOWN'});} if( $HELP ) { print $usage; exit($STATUSCODE{'UNKNOWN'});} if ( !($host) ){ print "ERROR: Missing required arguments\n"; print $usage; exit($STATUSCODE{'UNKNOWN'});}; my $dsn = 'DBI:Sybase:server=prime'; my $dbh = DBI->connect('DBI:Sybase:server=test;UID=sa;PWD=;'); if (!$dbh){die "Could not open connection to DSN because of [$!]";} my $query = $dbh->selectall_arrayref("SELECT COGIPF_STATUS FROM [PVP21_Audit].[dbo].[COGIPF_AGENTRUN] WHERE [COGIPF_LOCALTIMESTAMP] >= CONVERT(VarChar(20), +GetDate() +1,101)", { Slice => {} } ); foreach $query (@$query) { if ($query->{COGIPF_STATUS} eq 'Failed') {$failed = 1} } unless (@$query) { $failed = 1 }; if ( $failed == 0 ) { print "Jobs Succeeded\n"; exit($STATUSCODE{'OK'}); }elsif ( $failed == 1 ){ print "Job Failure\n"; exit($STATUSCODE{'CRITICAL'}); }else{ print "Undetermined error\n"; exit($STATUSCODE{'UNKNOWN'}); }

In reply to Connect to MS SQL on Linux by drodinthe559

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (7)
    As of 2018-07-19 15:48 GMT
    Find Nodes?
      Voting Booth?
      It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

      Results (411 votes). Check out past polls.