You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jean-Paul COGNET <je...@toutophone.com> on 2004/11/02 11:23:07 UTC

Re: pb setting NLS_LANG with mod_perl 1.99_14et DBD::Oracle

I have tried using Env::C (from CPAN), without using a startup.pl script.
And it is the same behaviour.
Any idea ?
Thank you very much.


The script is now :
========================================================
use DBI;
use DBD::Oracle;
use CGI;
use Env::C;
Env::C::setenv('NLS_LANG', 'french_france.WE8ISO8859P1',1);
Env::C::setenv('ORACLE_HOME', '/opt/oracle/product/10g/OraDB10g',1);
$ENTETE_HTML=0;
$q = new CGI;                        # create new CGI object

&EnteteHTML();

my $ar_env = Env::C::getallenv();
        print join "<br>\n", @$ar_env;

print "<br>\n";

 $dsn='DBI:Oracle:TOPDEV5';
 $user='user';
 $passwd='password';
 $dbh = DBI->connect($dsn, $user,$passwd);
print "dbh=$dbh<br>";
print "ERROR ? $DBI::errstr<br>";
&EndHTML();
#................................
sub EnteteHTML
#................................
 {
 return if ($ENTETE_HTML);
 print $q->header('text/html');
  print "<HTML>\n";
  print "<BODY TEXT=#000000 LINK=#FFFFFF ALINK=#FFFFFF VLINK=#FFFFFF
onLoad=document.next_DIALOG_OUTPUT_ID.XX_INPUT_XX.focus();>";
 $ENTETE_HTML++;
 }
#................................
sub EndHTML
#................................
 {
 return unless ($ENTETE_HTML);
 print "</BODY></HTML>\n";
 }

========================================================
and gives this output :
========================================================
HOSTNAME=jupiter.toutophone.com
SHELL=/bin/bash
TERM=xterm
HISTSIZE=1000
SSH_CLIENT=192.168.2.101 4325 22
SSH_TTY=/dev/pts/1
USER=root
LD_LIBRARY_PATH=/usr/local/apache2/lib:
LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;
33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=0
0;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:
*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;
31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.
gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
USERNAME=root
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/ActivePerl-5.8/bin/:/us
r/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/ro
ot/bin
MAIL=/var/spool/mail/root
PWD=/usr/local/apache2/bin
INPUTRC=/etc/inputrc
LANG=fr_FR.UTF-8
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
HOME=/root
SHLVL=2
BASH_ENV=/root/.bashrc
LOGNAME=root
SSH_CONNECTION=192.168.2.101 4325 192.168.2.120 22
LESSOPEN=|/usr/bin/lesspipe.sh %s
G_BROKEN_FILENAMES=1
_=/usr/local/apache2/bin/httpd
NLS_LANG=french_france.WE8ISO8859P1
ORACLE_HOME=/opt/oracle/product/10g/OraDB10g
dbh=
ERROR ? ORA-00604: error occurred at recursive SQL level 1 ORA-01756: quoted
string not properly terminated (DBD ERROR: OCISessionBegin)

========================================================


this script
=======================================================
use DBI;
use DBD::Oracle;
use CGI;
use Env::C;
#Env::C::setenv('NLS_LANG', 'french_france.WE8ISO8859P1',1);
Env::C::setenv('ORACLE_HOME', '/opt/oracle/product/10g/OraDB10g',1);
$ENTETE_HTML=0;
$q = new CGI;                        # create new CGI object
......
========================================================
produces
========================================================
HOSTNAME=jupiter.toutophone.com
SHELL=/bin/bash
TERM=xterm
HISTSIZE=1000
SSH_CLIENT=192.168.2.101 4325 22
SSH_TTY=/dev/pts/1
USER=root
LD_LIBRARY_PATH=/usr/local/apache2/lib:
LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;
33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=0
0;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:
*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;
31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.
gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
USERNAME=root
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/ActivePerl-5.8/bin/:/us
r/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/ro
ot/bin
MAIL=/var/spool/mail/root
PWD=/usr/local/apache2/bin
INPUTRC=/etc/inputrc
LANG=fr_FR.UTF-8
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
HOME=/root
SHLVL=2
BASH_ENV=/root/.bashrc
LOGNAME=root
SSH_CONNECTION=192.168.2.101 4325 192.168.2.120 22
LESSOPEN=|/usr/bin/lesspipe.sh %s
G_BROKEN_FILENAMES=1
_=/usr/local/apache2/bin/httpd
ORACLE_HOME=/opt/oracle/product/10g/OraDB10g
dbh=DBI::db=HASH(0x96e9578)
ERROR ?
============================================================================












----- Original Message ----- 
From: "Stas Bekman" <st...@stason.org>
To: "Jean-Paul COGNET" <je...@toutophone.com>
Cc: <mo...@perl.apache.org>
Sent: Friday, October 29, 2004 5:21 PM
Subject: Re: pb setting NLS_LANG with mod_perl 1.99_14et DBD::Oracle


> Jean-Paul COGNET wrote:
> > I upgrade with the new version of Apache 2.0 (httpd-2.0.52) and mod_perl
> > 1.99_17 and the behaviour is exactly the same.
>
> OK
>
> > If  I set NLS_LANG I obtain this logs just before connect
> > ORACLE_HOME=/opt/oracle/product/10g/OraDB10g
> > NLS_LANG=french_france.WE8ISO8859P1
> > I cannot connect and have this log in Apache
> > DBI connect('TOPDEV5','automate',...) failed: ORA-00604: error occurred
at
> > recursive SQL level 1
> > ORA-01756: quoted string not properly terminated (DBD ERROR:
> > OCISessionBegin) at /var/www/perl/automate1.pl line 1126
> >
> > If  I do not set NLS_LANG I obtain this logs just before connect
> > ORACLE_HOME=/opt/oracle/product/10g/OraDB10g
> > NLS_LANG=
> > and then I can connect but "été" becomes "ete"
>
> Please reread my reply again, besides upgrading I've asked you:
>
>  > What do you get when you print that value from a modperl script? Does
it
>  > show the right setting?
>
> Is that what you mean by 'I obtain this logs'?
>
> And this:
>
>  > Any difference if you use Env::C (from CPAN) to set it (it doesn't do
any
>  > locking, but you shouldn't have a problem, if you are using a prefork
mpm.
>
> -- 
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
>
> -- 
> Report problems: http://perl.apache.org/bugs/
> Mail list info: http://perl.apache.org/maillist/modperl.html
> List etiquette: http://perl.apache.org/maillist/email-etiquette.html
>


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: pb setting NLS_LANG with mod_perl 1.99_14et DBD::Oracle

Posted by Stas Bekman <st...@stason.org>.
Jean-Paul COGNET wrote:
> Hi Stas,
> Good advice !!
> I've found that a user have a similar problem using PHP, and that the only
> avalaible value for NSL_LANG is this case was
> 'American_America.EE8ISO8859P2'
> I've tried this value and it works, but with bad accents.
> "ou entrer l'heure d'enlèvement passée ou à venir. Entrer étoile si
> l'enlèvement ne pourra pas se faire"
> becomes
> "ou entrer l'heure d'enl?vement passée ou ? venir. Entrer étoile si
> l'enl?vement ne pourra pas se faire"
> 
> BUT with this strange value
> 'American_America.WE8ISO8859P1'
> it seems to work fine.
> "ou entrer l'heure d'enlèvement passée ou à venir. Entrer étoile si
> l'enlèvement ne pourra pas se faire"
> stays
> "ou entrer l'heure d'enlèvement passée ou à venir. Entrer étoile si
> l'enlèvement ne pourra pas se faire"
> 
> Maybe, Oracle doesn't like France ;-)

:)

> Thank you a lot Stas.

You're welcome, Jean-Paul.

But it should work w/o Env::C, if you set this env var at startup like you 
did in first place. Env::C is not good for threaded environment, since 
it's not thread safe. so it's only OK to use it for prefork MPM.


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

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: pb setting NLS_LANG with mod_perl 1.99_14et DBD::Oracle

Posted by Jean-Paul COGNET <je...@toutophone.com>.
Hi Stas,
Good advice !!
I've found that a user have a similar problem using PHP, and that the only
avalaible value for NSL_LANG is this case was
'American_America.EE8ISO8859P2'
I've tried this value and it works, but with bad accents.
"ou entrer l'heure d'enlèvement passée ou à venir. Entrer étoile si
l'enlèvement ne pourra pas se faire"
becomes
"ou entrer l'heure d'enl?vement passée ou ? venir. Entrer étoile si
l'enl?vement ne pourra pas se faire"

BUT with this strange value
'American_America.WE8ISO8859P1'
it seems to work fine.
"ou entrer l'heure d'enlèvement passée ou à venir. Entrer étoile si
l'enlèvement ne pourra pas se faire"
stays
"ou entrer l'heure d'enlèvement passée ou à venir. Entrer étoile si
l'enlèvement ne pourra pas se faire"

Maybe, Oracle doesn't like France ;-)

Thank you a lot Stas.

So if you have the same problem you can try this value....
Now my script is :
============================================================================
===
use DBI;
use DBD::Oracle;
use CGI;
use Env::C;

#Env::C::setenv('NLS_LANG', 'french_france.WE8ISO8859P1',1);
# Doesnt'work with mod_perl
# ===> ERROR ? ORA-00604: error occurred at recursive SQL level 1 ORA-01756:
quoted string not properly terminated (DBD ERROR: OCISessionBegin)

#Env::C::setenv('NLS_LANG', 'American_America.EE8ISO8859P2',1);
#Works but, not really fine

Env::C::setenv('NLS_LANG', 'American_America.WE8ISO8859P1',1);
#Seems to work !!!

Env::C::setenv('ORACLE_HOME', '/opt/oracle/product/10g/OraDB10g',1);

$ENTETE_HTML=0;

$q = new CGI;                        # create new CGI object

&EnteteHTML();
 $dsn='DBI:Oracle:TOPDEV5';
 $user='user';
 $passwd='password';
 $dbh = DBI->connect($dsn, $user,$passwd);
print "dbh=$dbh<br>";
print "ERROR ? $DBI::errstr<br>";
$SQLOrder="select MESSAGE_TEXT from AUDIO";
 my $sel1 = $dbh->prepare($SQLOrder);
 $sel1->execute()|| die "Error : $DBI::errstr";
 my @cols;
 while (@cols = $sel1->fetchrow_array) {
  my $name=$cols[0];
print "$name<br>";
}
&EndHTML();
#===========================================================================
===
sub EnteteHTML
#===========================================================================
===
 {
 return if ($ENTETE_HTML);
 print $q->header('text/html');
  print "<HTML>\n";
  print "<BODY TEXT=#000000 LINK=#FFFFFF ALINK=#FFFFFF VLINK=#FFFFFF
onLoad=document.next_DIALOG_OUTPUT_ID.XX_INPUT_XX.focus();>";
 $ENTETE_HTML++;
 }
#===========================================================================
===
sub EndHTML
#===========================================================================
===
 {
 return unless ($ENTETE_HTML);
 print "</BODY></HTML>\n";
 }






----- Original Message ----- 
From: "Stas Bekman" <st...@stason.org>
To: "Jean-Paul COGNET" <je...@toutophone.com>
Cc: <mo...@perl.apache.org>
Sent: Wednesday, November 03, 2004 1:29 AM
Subject: Re: pb setting NLS_LANG with mod_perl 1.99_14et DBD::Oracle


> Jean-Paul COGNET wrote:
> > I have tried using Env::C (from CPAN), without using a startup.pl
script.
> > And it is the same behaviour.
> > Any idea ?
> > Thank you very much.
>
> I've never used Oracle, so I can't really tell what the problem is. If you
> could figure out how to reproduce it with something else I'd be more
helpful.
>
> Any luck with using google.com to find the solution? Feeding that error
> message to google shows quite a lot of hits. I'm not sure how relevant
> they are to our case.
>
> -- 
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
>
> -- 
> Report problems: http://perl.apache.org/bugs/
> Mail list info: http://perl.apache.org/maillist/modperl.html
> List etiquette: http://perl.apache.org/maillist/email-etiquette.html
>


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: pb setting NLS_LANG with mod_perl 1.99_14et DBD::Oracle

Posted by Stas Bekman <st...@stason.org>.
Jean-Paul COGNET wrote:
> I have tried using Env::C (from CPAN), without using a startup.pl script.
> And it is the same behaviour.
> Any idea ?
> Thank you very much.

I've never used Oracle, so I can't really tell what the problem is. If you 
could figure out how to reproduce it with something else I'd be more helpful.

Any luck with using google.com to find the solution? Feeding that error 
message to google shows quite a lot of hits. I'm not sure how relevant 
they are to our case.

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

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html