Hi Monks,

I have a CGI module, which connects to an Oracle Server to retrieve values from it..
Please find the code below..
Now, the issue i am facing is, I am able to see the line 'This is before connecting' in the HTML rendered, but right after this, it stops execution, i cant see any errors, nor can i see any other print statements getting executed after this..
#!/usr/bin/perl use DBI; use CGI; print "Content-Type:text/html\n\n"; print<<__HTML__; <html> <head> </head> <title>Test123</title> <body> __HTML__ print "This is Official\n"; my $DB="MYDB1"; my $HOST="tpvpm12192"; my $PORT="1521"; my $USER="remote_usr"; my $PASS="passItToMe"; $ENV{ORACLE_HOME}="/opt/netcool/oracle"; $ENV{LD_LIBRARY_PATH}="/opt/netcool/oracle"; print "<br>$ENV{LD_LIBRARY_PATH}<br>"; print "This is before connecting\n"; my $MysqlDbh = DBI->connect("DBI:Oracle:host=$HOST;sid=$DB;port=$PORT" +,$USER, $PASS, {RaiseError => 0, AutoCommit => 1,PrintError => 1 }); if (! $MysqlDbh) { print "Error Error Error"; }else{ print "Connect Succeeded!!"; } my $Statement="select * from NodeInformationStore where Node = '123'"; my $Sth = $MysqlDbh->prepare($Statement); if (! $Sth) { print "Unable to prepare query $Statement.\n$DBI::errstr\n"; exit; } if (! $Sth->execute) { print "Unable to execute query $Statement\n$DBI::errstr\n"; exit; }else{ print "This query has been executed"; } print "</html>";


When I run this from commandline, it works fine. However, when invoked from the browser as a cgi, it fails. Could someone please help me out..

In reply to Connecting to Oracle DB using DBI from CGI script by LinuxUser2008

Title:
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, details, 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, summary, 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.