Can you use ALTER SESSION and set nls_language?

Martin
Hermann Schwaerzler wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hello

is it possible to change the character-encoding of the data one receives
from an oracle-DB at runtime? i.e. is it possible to have connections to
two oracle-DBs in one perl-application where from one DB you want to
receive utf8-data and from the other iso-8859-1 data?

we were not able to do this.
we tried to do the following:
 * set ORACLE_HOME, ORA_NLS33 to correct values
 * set NLS_LANG to e.g. american_america.WE8ISO8859P1
 * start the application and within that:
   + connect to the DB we want to get iso-8859-1 data from
   + change $ENV{'NLS_LANG'} to american_america.AL32UTF8
   + connect to the DB we want to get utf8 data from

doing so we got from BOTH DBs iso-8859-1 data.
when we started with NLS_LANG set to american_america.AL32UTF8 we ended
in getting utf8 data from both DBs.

to further investigate the problem we even patched dbdimp.c (dbd_init)
in DBD::Oracle to see if our NLS_LANG-change gets down to that level.
which it does.

from what it looks like, the character-encoding of the application gets
(unchangebly) set when the application starts (when the oracle
driver-libraries get linked to it?).

do we miss something obvious?
do you have any suggestions?

regards
hermann

ps: systeminformation:

Red Hat Enterprise Linux AS release 3 (Taroon Update 4)
 kernel  2.4.21-27.0.2.EL

Oracle Client:
 Client9.2.0.1

Oracle Servers:
 10g and 9i

DBI-version: 1.48
DBD::Oracle: 1.15

perlversion: 5.8.7
perl -V:
Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
 Platform:
   osname=linux, osvers=2.4.21-27.0.2.el, archname=i686-linux
   uname='linux ciab.uibk.ac.at 2.4.21-27.0.2.el #1 wed jan 12 23:46:37
est 2005 i686 i686 i386 gnulinux '
   config_args='-Dprefix=/opt/perl'
   hint=recommended, useposix=true, d_sigaction=define
   usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
   useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
   use64bitint=undef use64bitall=undef uselongdouble=undef
   usemymalloc=n, bincompat5005=undef
 Compiler:
   cc='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include
- -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
   optimize='-O2',
   cppflags='-fno-strict-aliasing -pipe -I/usr/local/include
- -I/usr/include/gdbm'
   ccversion='', gccversion='3.2.3 20030502 (Red Hat Linux 3.2.3-49)',
gccosandvers=''
   intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
   d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
   ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
   alignbytes=4, prototype=define
 Linker and Libraries:
   ld='cc', ldflags =' -L/usr/local/lib'
   libpth=/usr/local/lib /lib /usr/lib
   libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
   perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
   libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl.a
   gnulibc_version='2.3.2'
 Dynamic Linking:
   dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
   cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
 Compile-time options: USE_LARGE_FILES
 Built under linux
 Compiled at Jun 21 2005 10:17:02
 @INC:
   /opt/perl/lib/5.8.7/i686-linux
   /opt/perl/lib/5.8.7
   /opt/perl/lib/site_perl/5.8.7/i686-linux
   /opt/perl/lib/site_perl/5.8.7
   /opt/perl/lib/site_perl

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCznS3pZ4QdpzGMxwRAtjBAJ9MvrMaVcdqL75Sb1fzjnvHD7tRqwCfXWJ5
VRztV2LSnAV106kSF9stO4M=
=eDRw
-----END PGP SIGNATURE-----


Reply via email to