Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Content not display on GUI

by krisnaa1980 (Initiate)
on Mar 18, 2011 at 08:57 UTC ( #893948=perlquestion: print w/replies, xml ) Need Help??

krisnaa1980 has asked for the wisdom of the Perl Monks concerning the following question:

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

Replies are listed 'Best First'.
Re: Content not display on GUI
by marto (Cardinal) on Mar 18, 2011 at 09:40 UTC

    Yikes, I suggest you spend some time reading Ovid's CGI Course. Also please don't ignore the formatting advice which is display when posting.

Re: Content not display on GUI
by JavaFan (Canon) on Mar 18, 2011 at 10:15 UTC
    So, what output do you getting when telnetting to the server and asking for the resource? What shows up in your logs (errorlog, accesslog)? Why is your title floating between the head and the body? What happens if you make a page that doesn't do any db connections? Is the webserver process allowed to connect to the database? Are connections allowed between your webserver and the database server you connect to? Why do you have both RaiseError and PrintError set to 0? (After all, the last thing you want to do when things aren't working as planned is to silence all errors).

      To test, I created a sample script that contains the DBI info and it successfully connected and resulted with output, which work as expected. But when I use CGI for the same including some hard coding values, the CGI page displayed is empty

Re: Content not display on GUI
by tweetiepooh (Hermit) on Mar 18, 2011 at 13:02 UTC
    If you are trying to connect to Netcool I use something like
    BEGIN { $ENV{OMNIHOME}="<dir to omnibus>"; $ENV{SYBASE}="<dir to omnibus libs OMNIHOME/platform/solaris2 for +example>"; } my $INTERFACES = "$ENV{OMNIHOME}/etc/intefaces.solaris2"; use DBI; my $dbh = DBI->connect("dbi:Sybase:server=<servername>","user","pass") +; ...
      FreeTDS is installed under /usr/local/freetds folder and freetds.conf exists in /usr/local/freetds/etc folder. And that's the reason SYBASE environment variable is defined to /usr/local/freetds.

      From CLI, the results are seen but only having issue from GUI.

      regards,
      Krishna

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2022-10-02 22:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (13 votes). Check out past polls.

    Notices?