我在远程IBM AIX服务器上安装了Oracle 9i DB。 我想使用C#app(.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
不确定如何处理此问题。请建议