Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set NLS_LANG for oracle managed data access

I have a winforms c# application using Oracle 12c through oracle.manageddataaccess (via NHibernate 4.0), The oracle database is on another machine on customer site we've had issues with character set conversion due to NLS_LANG differences between the oracle database and the client machine. There is no Oracle client installed on the client machine (just using Managed driver).

We've found that you can specify the client NLS_LANG using an environment variable.

My question is: Are there any other ways to specify the NLS_LANG setting when using the new Managed Data Access in Oracle?

like image 792
Alex McMahon Avatar asked Jun 19 '14 13:06

Alex McMahon


1 Answers

I am using the OracleGlobalization to set Date format as follows. This might give you a clue..

 conn = new OracleConnection(connectionString);
        conn.Open();
        OracleGlobalization info = conn.GetSessionInfo();
        info.DateFormat = "YYYY-MM-DD";
        conn.SetSessionInfo(info);
like image 71
TonyP Avatar answered Oct 19 '22 14:10

TonyP