LinuxUser2008 has asked for the wisdom of the Perl Monks concerning the following question:
#!/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>";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Connecting to Oracle DB using DBI from CGI script
by Anonymous Monk on May 20, 2010 at 13:52 UTC | |
|
Re: Connecting to Oracle DB using DBI from CGI script
by bart (Canon) on May 20, 2010 at 21:19 UTC | |
by LinuxUser2008 (Acolyte) on May 23, 2010 at 11:52 UTC | |
by Anonymous Monk on Mar 21, 2018 at 12:22 UTC | |
|
Re: Connecting to Oracle DB using DBI from CGI script
by marto (Cardinal) on May 20, 2010 at 13:58 UTC |