NLS_LANG and ISAPI Apps

Holger Dors

Member²
We have a couple of ISAPI DLLs built with D6 + DOA 4.0.6. They run within the same IIS. They require different NLS_LANG settings; I'm setting the environment variable just before I do a Session.LogOn.

However, sometimes this settings just doesn't seem to be effective; we're seeing wrong characters.

Is the NLS_LANG var evaluated only when a session is created, or is it evaluated for each query? Because in the latter case, as the var is valid for the whole IIS process, it could have been changed to another value in between, and than I would be in trouble...

Anyone else has a suggestion or a comment for me on this matter?

Many thanks in advance,
Holger
 
NLS_LANG is evaluated by Oracle Net when the Oracle environment is initialized. This happens with the first logon, or if you use an OracleCI function that initializes it. If this is the first thing you do when the DLL initializes, you should be fine.
 
Marco,

thanks for the answer. However, I'm not sure if I'm fine ;-)

What happens in this case:

1. IIS starts
2. IIS loads ISAPI DLL 1 and connects to DB1 using NLS_LANG GERMAN_GERMANY.WE8MSWIN1252
3. IIS loads ISAPI DLL 2 and connects to DB2 using NLS_LANG GERMAN_GERMANY.WE8ISO8859P1

What NLS_LANG will the second DLL actually use? After all, Oracle has been initialized by the first DLL, hasn't it?

Thanks in advance,
Holger
 
No more ideas or hints, anyone? How can I make absolutley sure that a TOracleSession I create or created has a specific NLS_LANG setting?
 
There is a workaround.
You can use API function SetEnvironmentVariable
to change or set value of NLS_LANG variable.
Environment variables have higher priority above registry setings. So you can get the result you need very simply.
 
Thanks for the answer, however, this is what I'm already using. Problem is, it doesn't always work as expected, and I just don't know why.

Remember, I have one process (IIS) that loads variuos ISAPI DLLs that each create threads that each create oracle sessions against different databases, with different NLS_LANG setting needed.

It could even be that one thread of a DLL connects agains DB1 using UTF8, and another DLL connects against the same DB1 instance, but uses Win1252 as character sets.

And sometimes the setting just won't work, and I don't know why, because I don't know at what point Oracle (or DOA) is evaluating the setting of NLS_LANG!

Any pointers where I could get that inormation from?
 
Back
Top