Try Persist Security Info=True;
Data Source=TODO;Persist Security Info=True;Enlist=false;Pooling=true;Statement Cache Size=10;User ID=TODO;Password=TODO;
This comes from porting a connection string from SQL-Developer (or Toad)
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi everyone. I have an issue trying to connect Oracle with C#, I hope you can helpme.
I’m using Oracle SQL Developer and make the connection successfully:
Everything Works fine:
But then, when I’m trying to connect to that database from C#, I get an error:
using System.Data.OracleClient;
DataTable dtResult = new DataTable();
string cnnString2 = @"Data Source=xe; USER ID=system; PASSWORD=admin;";
using (OracleConnection cnn = new OracleConnection(cnnString2))
{
OracleCommand cmd = new OracleCommand( @"SELECT * FROM TABLE");
cmd.CommandType = CommandType.Text;
OracleDataAdapter da = new OracleDataAdapter(cmd);
cnn.Open();
da.Fill(dtResult);
cnn.Close();
}
return dtResult;
In the cnn.Open line, I get this error:
System.Data.OracleClient.OracleException: 'ORA-12154: TNS:could not resolve the connect identifier specified
I tried this same code in my personal laptop, and works ok, but I’m using now a Laptop from my company, and I get that error. The strange thing is that I can connect from the soft Oracle SQL Developer, but from C# nope. Anyone have some solution for this?
Thanks in advance.
Try Persist Security Info=True;
Data Source=TODO;Persist Security Info=True;Enlist=false;Pooling=true;Statement Cache Size=10;User ID=TODO;Password=TODO;
This comes from porting a connection string from SQL-Developer (or Toad)