Question

I've written this simple connection in my code:

OracleConnection con = new OracleConnection("Data Source=ORCL;User    
  ID=agapus;Password=agap");
con.Open();

Then I run my application pressing F5 and I get the above error. This error occurs no matter if it's just a simple console app or an ASP.NET web site. I've tried both Oracle.DataAccess and the old windows oracle API. I've tried several Oracle services, all with no luck. The environment where I'm testing this connection is a Windows Server 2008R2. I can easily connect to any database using SQLPlus or TOAD. I've tried explicitly specifying the location of the TNS_NAMES.ORA file, doesn't work either. The only thing that works is when I specify the full path in the connection string. So if I change the above code into the below one, it'll work:

string conString = "user id=agapus;password=agap;data source=(DESCRIPTION=(ADDRESS=     
  (PROTOCOL=tcp)(HOST=172.16.0.121)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)))";
  ID=agapus;Password=agap");
OracleConnection con = new OracleConnection(conString);
con.Open();     
Was it helpful?

Solution

If you look in your sqlnet.ora file, I believe that you will find that the default domain is set to .world .

That would make the correct name of your connection ORCL.world .

You may also have .world on the end of your connection name in TNSNAMES.ora, and nothing for the default domain.

What do you get when you run tnsping?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top