Print Thread
NLS_LANG issues
#9772 03/13/08 09:24 PM
Joined: Jul 2007
Posts: 3
J
Member
OP Offline
Member
J
Joined: Jul 2007
Posts: 3
Hi,

I'm trying to set NLS_LANG from code before logging on to the database, but keep running into some very odd issues.

There are two sequences of code that I've tried:
Code
SetEnvironmentVariable('NLS_LANG', PChar('.' + VALID_CHARSETS[g_nCharSet][0]));
p_oraSession.Logon;
Code
SetEnvironmentVariable('NLS_LANG', '.EL8MSWIN1253');
p_oraSession.Logon;
In the first sequence, VALID_CHARSETS is a constant two-dimensional array of string, and g_nCharSet is fetched from an INI file. In the second sequence, the specific value that is retrieved using the VALID_CHARSETS array is set as a literal. I am one hundred procent sure the argument in both sequences is the same (verified with logging and if structures), without any whitespace.

The second sequence works to fetch data as greek, the first doesn't. No other changes are in my code. If I fetch the value using GetEnvironmentVariable before I call Logon in both cases ".EL8MSWIN1253" is returned.

Any ideas on what may be causing this?

Thank you.

Re: NLS_LANG issues
#9773 03/14/08 03:34 PM
Joined: Aug 1999
Posts: 22,220
Member
Offline
Member
Joined: Aug 1999
Posts: 22,220
There must be some difference. Try a GetEnvironmentVariable after setting it, to verify that in both cases they are the same.


Marco Kalter
Allround Automations
Re: NLS_LANG issues
#9774 03/14/08 04:00 PM
Joined: Jul 2007
Posts: 3
J
Member
OP Offline
Member
J
Joined: Jul 2007
Posts: 3
I have already tried calling GetEnvironmentVariable, and the value is indeed changed (correct), both before and after the call to Logon. For some reason the Oracle session is just not picking it up.

I've been trying to debug this with a co-worker for over a day, we're completely baffled by this behavior because it makes no sense whatsoever.

If it is any help, this code is in a service.


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.095s Queries: 13 (0.030s) Memory: 2.5058 MB (Peak: 3.0436 MB) Data Comp: Off Server Time: 2024-05-18 23:40:32 UTC
Valid HTML 5 and Valid CSS