本文介绍了SET_NLS对Oracle ODP.net进行故障转移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用ODP.NET从c#程序中执行以下语句:
I try to execute the follwing statement from a c# program with ODP.NET:
string sql = "BEGIN dbms_session.set_nls('NLS_NUMERIC_CHARACTERS','''.,'''); END;";
using (OracleConnection connection = new OracleConnection("Data Source=db;User Id=a;Password=b"))
{
connection.Open();
using (OracleCommand command = new OracleCommand(sql, connection))
{
command.ExecuteNonQuery();
}
connection.Close();
}
我检索了以下错误消息:
I retrieve the follwing error message:
ORA-02074:无法在分布式事务中设置NLS
我在代码中不使用任何交易. OracleConnection是隐式分布式事务吗?如果我在连接字符串中添加 enlist = false ,它将起作用.但是我不知道为什么.
I don't use any transaction in my code. Is the OracleConnection an implicit distributed transaction? If I add enlist=false to the connection string it works. But I don't know why.
推荐答案
我在我的环境中不需要分布式事务,因此我只是通过在连接字符串后附加enlist=false
来解决此问题.希望它对某人有用.
I don't need distributed transactions in my environment, so I just solved this by appending enlist=false
to my connection string. Hope it may be useful to someone.
这篇关于SET_NLS对Oracle ODP.net进行故障转移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!