oracle 9i: ora-12705 指定的 nls 参数值无效或未知
我在远程 IBM AIX 服务器上安装了 Oracle 9i DB。 我想使用 C# 应用程序 (.Net) 连接到它 目前,我可以在我的机器上使用 SQL Developer 和 SQLPlus 连接到它。
但是当我尝试使用 System.Data.OracleClient 从 Visual Studio App 连接时。
private static string GetConnectionString()
{
return "Data Source=<server address>;User ID=<username>;Password=<password>;";
}
// This will open the connection and query the database
private static void ConnectAndQuery()
{
string connectionString = GetConnectionString();
using (OracleConnection connection = new OracleConnection())
{
try
{
connection.ConnectionString = connectionString;
connection.Open();
Console.WriteLine("State: {0}", connection.State);
Console.WriteLine("ConnectionString: {0}",
connection.ConnectionString);
OracleCommand command = connection.CreateCommand();
string sql = "SELECT * FROM demo";
command.CommandText = sql;
OracleDataReader reader = command.ExecuteReader();
while (reader.Read())
{
string myField = (string)reader["f1"];
Console.WriteLine(myField);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
connection.Close();
}
finally
{
connection.Close();
}
}
}
我收到以下错误:
ORA-12705 指定的 NLS 参数值无效或未知
我已检查 NLS 的注册表值,它已设置为 AMERICAN_AMERICA.WE8MSWIN1252
不确定如何处理此问题。请建议
I have an Oracle 9i DB installed at remote IBM AIX server.
I want to connect to it using C# app (.Net)
Presently, I am able to connect to it using SQL Developer and SQLPlus from my machine.
But when I try to connect from Visual Studio App, using System.Data.OracleClient.
private static string GetConnectionString()
{
return "Data Source=<server address>;User ID=<username>;Password=<password>;";
}
// This will open the connection and query the database
private static void ConnectAndQuery()
{
string connectionString = GetConnectionString();
using (OracleConnection connection = new OracleConnection())
{
try
{
connection.ConnectionString = connectionString;
connection.Open();
Console.WriteLine("State: {0}", connection.State);
Console.WriteLine("ConnectionString: {0}",
connection.ConnectionString);
OracleCommand command = connection.CreateCommand();
string sql = "SELECT * FROM demo";
command.CommandText = sql;
OracleDataReader reader = command.ExecuteReader();
while (reader.Read())
{
string myField = (string)reader["f1"];
Console.WriteLine(myField);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
connection.Close();
}
finally
{
connection.Close();
}
}
}
I get the following error:
ORA-12705 invalid or unknown NLS parameter value specified
I have checked registry values for NLS it is already set to AMERICAN_AMERICA.WE8MSWIN1252
Not sure how to handle this. Please suggest
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
dba-oracle.com 讨论了此问题的一些可能原因。
Some possible causes for this problem are discussed here on dba-oracle.com.