RE: Connect failure: OCIEnvNlsCreate (check ORACLE_HOME and NLS settings etc.)

RE: Connect failure: OCIEnvNlsCreate (check ORACLE_HOME and NLS settings etc.)

am 25.08.2005 16:57:02 von Ron.Reidy

Victor,

I believe this is a permissions issue. There was a posting to this =
group a few months ago that was very similar in nature. Look around the =
archives for it.

-----------------
Ron Reidy
Lead DBA
Array BioPharma, Inc.


-----Original Message-----
From: Victor Churchill [mailto:victor@qonnectis.com]
Sent: Thursday, August 25, 2005 8:17 AM
To: dbi-users@perl.org
Subject: Connect failure: OCIEnvNlsCreate (check ORACLE_HOME and NLS
settings etc.)=20


Hello all,
I've searched and found a few references to the above error, but none=20
that seems to suit my situation. I wonder if anyone here may have an=20
idea of what I should look for next...

I have a pretty straightforward setup (I hope!):

Database server on box "DB" :
Oracle Database 10g Release 10.1.0.3.0 - 64bit Production
Red Hat Enterprise Linux ES release 3 (Taroon Update 5), kernel=20
2.4.21-27.elsmp

Web server on box "WS" :
Perl 5.8.0
Apache 2.0.46
mod_perl is configured into the Apache by default but I am NOT using it
Oracle Instant Client 10.2
Red Hat Enterprise Linux ES release 3 (Taroon Update 5), kernel=20
2.4.21-23.elsmp

Also a development system on box "Dev":
perl 5.8.0
Oracle 8.1.7
Red Hat Fedora Core 3, kernel 2.4.18-11smp

Oracle Instant Client on WS has been set up following the 'recipe' (Tim=20
Barrass, 2/17/05 in this group). WS has a copy of tnsnames.ora=20
identifying both DB and Dev services.

WS Instant Client can connect to databases on DB and on Dev using=20
sqlplus from command-line.

As a check, Dev can connect to DB using sqlplus from command-line.

Here's the odd thing...

With a test script run from the command line, WS can connect to DB or to =

Dev using DBD::Oracle.

From a CGI perl script it can't. Instead I see the dreaded=20
OCIEnvNlsCreate (check ORACLE_HOME and NLS settings etc.)

Both the manual test script (which works) and the CGI script (that=20
doesn't) make use of the same environment-setting comands, imported from =

a "require"d file:

package dbProperties;
require Exporter;
@ISA=3Dqw(Exporter);

@EXPORT =3D qw ( $ENV{'PATH'}
$ENV{'ORACLE_HOME'}
$ENV{'LD_LIBRARY_PATH'}
$ENV{'SQLPATH'}
$ENV{'TNS_ADMIN'}
$ENV{'PERL5LIB'}
$ENV{'NLS_LANG'}
$dsn $dbuser $dbpassword
$appIP $LXASIP $DDSIP );

#### Oracle Environment and variable assignments

$ENV{'PATH'} =
'/usr/local/OraClient/instantclient_10_2/bin:/usr/kerberos/b in:/usr/local=
/bin:/bin:/usr/bin:/usr/X11R6/bin';
$ENV{'ORACLE_HOME'} =3D '/usr/local/OraClient/instantclient_10_2';
$ENV{'LD_LIBRARY_PATH'} =3D =
'/usr/local/OraClient/instantclient_10_2/lib';
$ENV{'SQLPATH'} =3D =
'/usr/local/OraClient/instantclient_10_2/bin';
$ENV{'TNS_ADMIN'} =3D '/usr/local/OraClient';
$ENV{'PERL5LIB'} =
'/usr/local/OraClient/instantclient_10_2/perl-modules/lib/pe rl5/site_perl=
/5.8.0/i386-linux-thread-multi';

$ENV{'NLS_LANG'} =3D 'AMERICAN_AMERICA.UTF8';# '',=20
'WE8ISO8859P1','ENGLISH','AL32UTF8' also tried...;

$dsn =3D q{dbi:Oracle:QQ3_VLAN} ;
($dbuser,$dbpassword) =3D ("foo","foo");


Putting a print into the CGI script, and running 'env' on the command=20
line, shows that the two connection-attempots both have the same values=20
for these environment variables:

PERL5LIB=3D/usr/local/OraClient/instantclient_10_2/perl-modu les/lib/perl5=
/site_perl/5.8.0/i386-linux-thread-multi
LD_LIBRARY_PATH=3D/usr/local/OraClient/instantclient_10_2/li b:
TNS_ADMIN=3D/usr/local/OraClient
PATH=3D/usr/local/OraClient/instantclient_10_2/bin:/usr/kerb eros/bin:/bin=
:/usr/bin:/usr/local/bin:/usr/bin/X11:/usr/X11R6/bin:/home/q g/bin
LANG=3Den_US.UTF-8
SQLPATH=3D/usr/local/OraClient/instantclient_10_2/bin
ORACLE_HOME=3D/usr/local/OraClient/instantclient_10_2

It's obvious that I'm still missing something. It's not obvious to me=20
what that is. Can anyone suggest what I should look for next?

Thanks,

victor churchill

This electronic message transmission is a PRIVATE communication which =
contains
information which may be confidential or privileged. The information is =
intended=20
to be for the use of the individual or entity named above. If you are =
not the=20
intended recipient, please be aware that any disclosure, copying, =
distribution=20
or use of the contents of this information is prohibited. Please notify =
the
sender of the delivery error by replying to this message, or notify us =
by
telephone (877-633-2436, ext. 0), and then delete it from your system.

RE: Connect failure: OCIEnvNlsCreate (check ORACLE_HOME and NLS

am 25.08.2005 19:06:31 von Victor

Hi Ron,
Thanks for the reply. I've done another search of the group but not
found anything specifically permissions-related. I assume you mean the
permissions of the owner of the httpd processes (on this box, 'nobody')
...?

I did pick up a suggestion that the %ENV settings might need to be done
at startup of the web server rather than at the time the script runs,
and have tried sourcing a file to set up the apache environment, but the
shell envt does not seem to find its way into the Perl ENV hash - at
least, not that I can see.

I've also tracked down, by manually setting/unsetting envt variables,
that the test-script from the command line depends specifically on
having LD_LIBRARY_PATH in the environment of the shell process : i.e.,
the owning shell needs to have this set _even though_ the perl script
explicitly sets
$ENV{'LD_LIBRARY_PATH'} = '/usr/local/OraClient/instantclient_10_2/lib';

- i.e., the same test scipt runs at the cmd line if the user has that
set but not if he does not.

So it looks like the question now becomes "How to set an environment
variable for the owner of the httpd process?" Does that make sense?

thanks,

victor

On Thu, 2005-08-25 at 15:57, Reidy, Ron wrote:
> Victor,
>
> I believe this is a permissions issue. There was a posting to this group a few months ago that was very similar in nature. Look around the archives for it.
>
> -----------------
> Ron Reidy
> Lead DBA
> Array BioPharma, Inc.
>
>

--
Victor Churchill
Qonnectis Group plc