Reputation: 2956
I've created dataset and can preview data with table adapters. But when I run the program, OracleConnection initialized with same connection string throws TNS:could not resolve the connect identifier! Why it works in designer but doesn't when I run it?
Here is what I've got:
MYTNS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.220.90)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = MYTNS )
)
)
Upvotes: 0
Views: 2133
Reputation: 2956
Thanx guys for your input. It helped me in general to understand how this works. But it seems that the problem is in environment variable "path" and machine.config. When running designer, it reads info from registry and succusfully finds all dlls needed, but at the runtime it uses path. So, you just put your chunk of path that points to ORA home infront.
Manipulating path is a well known recipe, however before you gain a deeper understanding of how ora provider .NET works you'll end up trying everything that you know of brainlessly.
Upvotes: 2
Reputation: 13420
It appears that your problem has already been solved, but I figured I would add this in case someone else came along in the future.
I have had this same issue before and have used SysInternals Process Monitor to see that my application was attempting to retrieve the tnsnames file of an older oracle install on my machine.
http://technet.microsoft.com/en-us/sysinternals/bb896645
Upvotes: 3