logo       

Re: mod_perl2 & DBD::Oracle problem: msg#00279

apache.mod-perl

Subject: Re: mod_perl2 & DBD::Oracle problem

Atsushi Fujita wrote:
Hi all,

I am trying to use DBD::Oracle1.12 on mod_perl2.
But it doesn't work fine.
It shows error as following in error_log at $dbh = DBI->connect.

----[error_log]----
DBI->connect(ynt0) failed: (UNKNOWN OCI STATUS 1804) OCIInitialize. Check
ORACLE_HOME and NLS settings etc. at
/yopt/httpd-2.0.39_prefork_perl5.6.1normal/cgi-bin/test1.cgi line 42
[Mon Jul 29 20:15:37 2002] [error] 25703: ModPerl::Registry: `Cannot connect:
(UNKNOWN OCI STATUS 1804) OCIInitialize. Check ORACLE_HOME and
NLS settings etc.at
/yopt/httpd-2.0.39_prefork_perl5.6.1normal/cgi-bin/test1.cgi line 42.
--------


----[test1.cgi]----
use DBI;

my $dsn = 'dbi:Oracle:';
my $user = 'username/password';
my $password = '';

$ENV{'ORACLE_HOME'} = '/u01/app/oracle/product/9.0.1';
$ENV{'ORACLE_SID'} = 'ynt0';
$ENV{'NLS_LANG'} = 'japanese_japan.ja16euc';

print "ORACLE_HOME=$ENV{'ORACLE_HOME'}<br>\n";
print "ORACLE_SID=$ENV{'ORACLE_SID'}<br>\n";
print "NLS_LANG=$ENV{'NLS_LANG'}<br>\n";
print "DSN=$dsn$ENV{'ORACLE_SID'}<br>\n";

$dbh = DBI->connect("$dsn$ENV{'ORACLE_SID'}", $user, $password)
or die "Cannot connect: ".$DBI::errstr;
...
--------

At first, I suspect that the reason is %ENV in this script.
But I set surely, and this output as following.

----[Broser output HTML]----
ORACLE_HOME=/u01/app/oracle/product/9.0.1
ORACLE_SID=ynt0
NLS_LANG=japanese_japan.ja16euc
DSN=dbi:Oracle:ynt0

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to
complete your request.
....
--------

And if I turned off the mod_perl, it works fine on normal CGI-script.
This error occurred only mod_perl.
(I tested mod_perl1.26 & apache 1.3.26, it worked fine...)

My machine is as following.
- perl5.6.1(non thread)
- DBI-1.30
- DBD-Oracle-1.12
- mod_perl1.99_04(DSO build)
- apache2.0.39(prefork)


----[httpd.conf]----(is this wrong??)
LoadModule perl_module modules/mod_perl.so
.......
<IfModule mod_perl.c>
PerlModule ModPerl::Registry
<Location /cgi-bin>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
</Location>
</IfModule>
--------

Do you suggest that %ENV is getting lost along the way? Or can it be some other problem? I don't have Oracle to test with. Or can you think of some other way to reproduce the problem without depending on Oracle being installed?

Can you please test with the following two approaches:

1.

instead of using ModPerl::Registry, use Apache::Registry. Of course configure <Location> to use Apache::Registry.

use Apache::compat;
use Apache::Registry; # hopefull you have mod_perl 1.0 installed

any change when you use the Apache::Registry from 1.0? Currently the only difference (mainly) is that ModPerl::Registry doesn't chdir() into the script's dir. (which eventually will change)

2. use a mod_perl handler


__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxxxxxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise