----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, April 16, 2001 7:52 AM
Subject: Oracle-DBI-Win2k-Apache


> Have a test which executes & fine on command line but
> same script stops @ connect line when run as cgi
>  via browser.

Did you check the error log of the webserver? Might be that your script dies
on the connect statement.

> ********************************************
> #!d:/perl/bin/perl.exe -w
>
> print "Content-type: text/html\r\n\r\n";
> use CGI;
> BEGIN {
>   $ENV{SERVER_NAME}="me.company.org";
>   $ENV{ORACLE_HOME}="c:\orant";
>   $ENV{ORACLE_SID}="orat1";
>   $ENV{DBI_TRACE}=3;
>   $ENV{PERL_DBI_DEBUG}=3;

Please don'r do this. Setting environment var's isnt one of the
functionalities of your script.
Make sure they are set for the webserver before your script is executed.
Is see you are connecting by SID. You might wanna trie connecting to the TNS
service layer instead,

> }
>       foreach $key (keys %ENV) {
>       print "$key --> $ENV{$key}";
> }
>
> foreach $dir (@INC) {
> print "$dir\n"
> }
> print "\n test11 \n<\H2>";
> %attr = (
>  PrintError => 0,
>  RaiseError => 1
> );
> my $dbh = DBI->connect("dbi:Oracle:orat1", "system", "manager", \%attr )
>     or die "cant connect: , $dbi::errstr(), \n";

I think this is where your script dies!
Check STDERR (e.g. webservers error_log for details).
By the way, you wont get the error returned by dbi in this way, because the
double colon wont be resolved in strings. Besides you are calling the errstr
method on an instance as a class method. Better use $dbh->errstr(). This
might not contain an error message in this case, because the conenction
failed and $dbd might not point to an object.


Reply via email to