in reply to Re^11: CGI-SQL Query Issue
in thread CGI-SQL Query Issue

What error did you get from using DBI ?. Try this simple script

#!/usr/bin/perl use strict; use warnings; use CGI; use CGI::Carp 'fatalsToBrowser'; use DBD::Oracle; my $q = new CGI; my $dbh = DBI->connect( 'dbi:Oracle:host=localhost;sid=DB','USER','PASSWORD', {RaiseError => 1 , PrintError => 0} ); my ($msg) = $dbh->selectrow_array( 'SELECT CURRENT_TIMESTAMP FROM DUAL'); print $q->header,$q->start_html, $q->h2($msg),$q->end_html;
poj

Replies are listed 'Best First'.
Re^13: CGI-SQL Query Issue
by Anonymous Monk on Mar 18, 2016 at 17:35 UTC
    Hi, What DB, USER & PASSWORD do I need to use? I don't see DB entry in your connect string. Anyways, I adapted USER & PASSWORD info & it threw HTTP 500 error. Regards

      Try the same username/password/sid as your SQLplus connection.
      Run this to compare the web and command line environments

      #!/usr/bin/perl use strict; use warnings; use Data::Dumper; print "Content-type: text/plain\n\n"; print Dumper \%ENV;
      poj
        Hi, Can you please tell about this SID? It seems it is not configured in my system. When I do a print of $ORACLE_SID, it does not print anything..