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