Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

OCIEnvNLSCreate using Cygwin and Perl

635731Apr 23 2008 — edited Jun 10 2008
Hi
I have Cygwin 1.5.25 installed with Oracle 10g Client on Windows XP Professional. I have installed DBD::Oracle (1.21) and Perl 5.8

Here is my environment
ORACLE_HOME C:\oracle\product\10.2.0\client_2
LD_LIBRARY_PATH %ORACLE_HOME%\bin
TNS_ADMIN %ORACLE_HOME%\NETWORK\ADMIN\tnsnames.ora
NLS_LANG AMERICA_AMERICA.WE8DEC
ORACLE_SID CBDEV
TWO_TASK CBDEV (available in tnsnames.ora)
ORA_NLS10 C:\oracle\product\10.2.0\client_2\nls\data
SQLPLUS %ORACLE_HOME%\BIN

Cygwin picks up all the above variables at startup
sqlplus <uname/passwd>@CBDEV also works from the cygwin shell

However below script, which uses Perl DBI to connect to same database to retrieve data fails with error posted below.

I googled for this error and from all posted threads, changed permissions on ORACLE_HOME/BIN and ORACLE_HOME/LIB. Also did the same for entire ORACLE_HOME directory

ANY input would be appreciated. I did not find a separate forum for Perl, hence posted on this forum!!

Thanks
---------------------------------
#!/usr/bin/perl

use strict;
use DBI;

print "Getting Data\n";
my $RefHash = &getData();
$ENV{ORACLE_SID} = "CBDEV";
$ENV{ORACLE_HOME} = "/oracle/product/10.2.0/client_2";
$ENV{NLS_LANG} = "AMERICAN_AMERICA.WE8DEC";
$ENV{ORA_NLS} = $ENV{ORACLE_HOME}."/ocommon/nls/admin/data";
$ENV{LD_LIBRARY_PATH} = $ENV{ORACLE_HOME}."/lib";
$ENV{ORA_NLS10} = '/oracle/product/10.2.0/client_2/nls/data';

sub getData() {
my($name, $id, $phylocId);
my %RefHash;

my $dbh = DBI->connect('DBI:Oracle:CBDEV', '<uname>', '<passwd>') || die "Error ".DBI->errstr;
my $sql = qq(SELECT 'name' from DUAL);

my $sth = $dbh->prepare($sql);
$sth->execute();
$sth->bind_columns(\$name);

while($sth->fetch()) {
$name=~s/\s+//g;
$RefHash{$name}='1';
print "Name : $name ", $RefHash{$name}, "\n";
}
return \%RefHash;
}

exit;

----------------------------------
Output of Perl -V

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=cygwin, osvers=1.5.24(0.15642), archname=cygwin-thread-multi-64int
uname='cygwin_nt-5.1 reini 1.5.24(0.15642) 2007-01-31 10:57 i686 cygwin '
config_args='-de -Dmksymlinks -Duse64bitint -Dusethreads -Uusemymalloc -Doptimize=-O3 -Dman3ext=3pm -Dusesitecustomize -Dusedevel'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -Wdeclaration-after-statement',
optimize='-O3',
cppflags='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -Wdeclaration-after-statement'
ccversion='', gccversion='3.4.4 (cygming special, gdc 0.12, using dmd 0.125)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='ld2', ldflags =' -s -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib /lib
libs=-lgdbm -ldb -ldl -lcrypt -lgdbm_compat
perllibs=-ldl -lcrypt -lgdbm_compat
libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' -s'
cccdlflags=' ', lddlflags=' -s -L/usr/local/lib'


Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP PERL_USE_SAFE_PUTENV
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_PERLIO USE_REENTRANT_API USE_SITECUSTOMIZE
Locally applied patches:
CYG01 - hints.cygwin.sh ldflags -s
CYG02 - lib-ExtUtils-Embed insensitive against leading \s
CYG03 - lib-Test-Harness-Straps $ENV{PERL5LIB} = ''
CYG04 - major.version.cygwin.sh cygperl-5_8.dll and not cygperl-5_8_x.dll
CYG05 - add Win32CORE to core
CYG07 - File-Spec-Cygwin-TMPDIR.patch
Bug#38628 - allow legacy Cwd->cwd()
Bug#40103 - File-Spec-case_tolerant.patch from 5.9.5
Built under cygwin
Compiled at Jul 8 2007 19:12:08
%ENV:
PERL5LIB=
/usr/lib/perl5/5.8/cygwin
/usr/lib/perl5/5.8
/usr/lib/perl5/site_perl/5.8/cygwin
/usr/lib/perl5/site_perl/5.8
/usr/lib/perl5/site_perl/5.8
/usr/lib/perl5/vendor_perl/5.8/cygwin
/usr/lib/perl5/vendor_perl/5.8
/usr/lib/perl5/vendor_perl/5.8
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 8 2008
Added on Apr 23 2008
4 comments
4,628 views