设置NLS_LANG用于Oracle托管数据访问 [英] Set NLS_LANG for oracle managed data access
问题描述
我有一个通过Oracle.manageddataaccess(通过NHibernate 4.0)使用Oracle 12c的winforms c#应用程序,由于客户数据库与NLS_LANG的差异,客户数据库上的Oracle数据库位于客户站点的另一台机器上客户端计算机.客户端计算机上没有安装Oracle客户端(仅使用托管驱动程序).
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).
我们发现您可以使用环境变量指定客户端NLS_LANG.
We've found that you can specify the client NLS_LANG using an environment variable.
我的问题是: 在Oracle中使用新的托管数据访问时,是否还有其他方法可以指定NLS_LANG设置?
My question is: Are there any other ways to specify the NLS_LANG setting when using the new Managed Data Access in Oracle?
推荐答案
我正在使用OracleGlobalization设置Date格式,如下所示.这可能会给您一个线索.
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);
这篇关于设置NLS_LANG用于Oracle托管数据访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!