NLS_LANG not taken from selected Oracle_Home

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
DEVNET
Posts: 1
Joined: Tue 14 May 2019 06:20

NLS_LANG not taken from selected Oracle_Home

Post by DEVNET » Tue 14 May 2019 06:38

Hi,

we are using dotConnect Universal with Oracle.

Lets assume this: Two Oracle clients installed on a machine "A" and "B".
"A" is the first in the Path

Aplication should use "B" so we add "Oracle_Home = B" to the connection string.
This works perfecly fine, its taking the OCI.dll from the "B" client.

But we have the impression that ist not taking the NLS_Lang setting from the "B" client, but uses the "A" client for that.
Could you please confirm that you not only using the OCI.dll but also all the settings from this special Oracle:home and not taking any defaults from the first client in the path ?

In one of the posts you suggested below:
You can use the "Run Once Command" connection string parameter to set the necessary NLS_LANG value. For example, add the following string to your connection string:

Code: Select all

"Run Once Command=ALTER SESSION SET NLS_LANGUAGE= 'AMERICAN';"


Do you have an example on the usage of this. We are using below lines of code to connect to oracle using UniConnection.
using (UniConnection testConnection = new UniConnection(connectionString))
{
try
{
testConnection.Open();
testConnection.Close();
}
}

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: NLS_LANG not taken from selected Oracle_Home

Post by Pinturiccio » Thu 16 May 2019 15:05

viewtopic.php?t=38725
This is the Oracle Client behavior. The same NLS_LANG is used for all Oracle Clients with the same major version. NLS_LANG value is taken from the first loaded Oracle Client. For example, if you have two Oracle Clients 12.x, they both will have the same NLS_LANG. Since default home is loaded at first, its NLS_LANG is used for all Oracle Clients with the same major version.
We will investigate the possibility of changing this behavior from our side, but there is no timeframe.
DEVNET wrote: Do you have an example on the usage of this. We are using below lines of code to connect to oracle using UniConnection.
using (UniConnection testConnection = new UniConnection(connectionString))
{
try
{
testConnection.Open();
testConnection.Close();
}
}
Use the following code:

Code: Select all

using (UniConnection testConnection = new UniConnection("Provider=Oracle; Host=<HOST>; User Id=<User Id>; Password=<PASSWORD>; Home=<Home>; Run Once Command=\"ALTER SESSION SET NLS_LANGUAGE= 'AMERICAN'\";"))

Post Reply