HI All,
I have installed DBI, FreeTDS and DBD::Sybase modules and written this below script:
#!/usr/bin/perl -w
BEGIN {
$ENV{"SYBASE"} = "/usr/local/freetds";
$ENV{"DSQUERY"} = "NCOT6P";
$ENV{"OMNIHOME"} = qw(/opt/app/netcool/omnibus);
$ENV{"LD_LIBRARY_PATH"} = "/usr/local/freetds/lib";
}
use strict;
use CGI;
use DBI;
use DBD::Sybase;
print "Content-type: text/html\n\n";
print <<HTML;
<html>
<head>
</head>
<title>Suppress Alarms</title>
<body>
HTML
my (@available_drivers, $dbh, $sql_statement, $sth, @array) = ();
@available_drivers = DBI->available_drivers;
print ("\nThe available DBD drivers are: @available_drivers.\n");
$dbh = DBI->connect('dbi:Sybase:NCOT6P;interfaces:$ENV{OMNIHOME}/etc/i
+nterfaces.solaris2;loginTimeout=10;timeout=120', "dsybase", "dsybase"
+, { RaiseError=> 0
, PrintError => 0, AutoCommit => 0 } );
my $select_sql = "select Summary from alerts.status where ServerSerial
+ = 16238215";
$sth = $dbh->prepare("$select_sql");
$sth->execute();
while (my $summary = $sth->fetchrow_array) {
print "\nSummary --> $summary\n";
}
$sth->finish;
$dbh->disconnect;
print "</body></html>";
From Command Line if i run, i see the below result:
$=>perl SuppAlarms.cgi
Content-type: text/html
<html>
<head>
</head>
<title>Suppress Alarms</title>
<body>
The available DBD drivers are: DBM ExampleP File Gofer Multiplex Proxy Sponge Sybase.
Summary --> GENERAL EVENT: Link down due to oper down ZEndPoint:cncrnhso09w-cs-p1 PortNumber=TenGigE0/0/0/2
</body></html>
But from GUI, nothing is displayed. Any help is apprecaited.
regards,
Krishna
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.