Hi Gurus,
I am trying to connect to a remote Oracle server using a CGI program
given below.
CGI Code :
----------
<code>
#!c:\perl\bin\perl
use CGI;
use DBI;
$q = new CGI;
print $q->header;
BEGIN {
$ENV{ORACLE_HOME} = "g:\\Ora81";
$ENV{ORACLE_SID} = "Ifund2";
}
## user name
my $dbh = DBI->connect("dbi:Oracle:MY_DSN", "user", "passwd", {
RaiseError => 1, PrintError => 1 } ) or
die $DBI::errstr;
$sql_query = "Select * from UserMaster";
$sql_sth = $dbh->prepare($sql_query);
if ($sql_sth->execute) {
while (@array = $sql_sth->fetchrow_array) {
print "DATA : @array\n\n";
}
}
</code>
My problem is that my code works fine on the command prompt. But when
i
try to run this program through the broswer its gives me an error. I
am
using Win NT and the Oracle server is on a Windows XP machine. The
error
message that i get in the apache error log is as below :
<log>
[Sat Sep 07 18:34:25 2002] [error] [client 127.0.0.1]
DBI->connect(Ifund2) failed: [Oracle][ODBC][Ora]Server rejected the
connection. (SQL-08004)(DBD: db_login/SQLConnect err=-1) at
</log>
As for the ODBC, I have made an entry in the System DSN for Oracle
ODBC
Driver with the service name as Ifund2.
Besides this CGI program works on the Oracle Server machine showing me
the result of the query executed.
Thanx,
Pramod.