Set TNSNAMES.ORA file path.
Step 2:
On the left hand side you can see the Advanced System Settings
Step 3:
Click on Advanced System Settings
Step4 :
Click the Environment Variables Button
Step5 : You can see Two boxes . Go to the second one.
Step6 : Click on New
Step 7 : A new window opens .
Give the Variable name as TNS_ADMIN
Give the Variable Value as "Path of the OracleClient which contains tnsnames.ora file"
for ex : C:\app\Oracle\product\11.2.0\client_1\Network\Admin
Step 8: Click OK.
Most of the times we end up having mutliple oracle clients when we are working with .net as front end and oracle as the back end.
If you want to work with the UserDefinedDatatypes, then we need to install the ODP.net client.
Depending on the version of the framework , we have to install a different ODP.net. Sometimes we end up in working on multiple versions of framework and we have different ODP.net clients in our systems.
As client will be installed in a different folder. We add up adding tnsnames.ora file inside each client and we dont realise that both the clients should have the same tnsnames.ora file. Because we never know which tnsfile will be picked up by our dotnet framework. If you add a new tns in one file and forgot to add in the other, you will see an exception saying "TNS listener could not be found".
To avoid the confusion here, and to make our job easy, we can set the path of the TnsNames.Ora file in the environment Variables. So that both the oracle and the .netframework will refer to the same path.
How to set the TNSNAMES.ORA Path
Step1:
Step 2:
On the left hand side you can see the Advanced System Settings
Step 3:
Click on Advanced System Settings
Step4 :
Click the Environment Variables Button
Step5 : You can see Two boxes . Go to the second one.
Step6 : Click on New
Step 7 : A new window opens .
Give the Variable name as TNS_ADMIN
Give the Variable Value as "Path of the OracleClient which contains tnsnames.ora file"
for ex : C:\app\Oracle\product\11.2.0\client_1\Network\Admin
Step 8: Click OK.
Now the TNSFile Path is set. There is no need for you to update in all the oracle clients whenever you need to add a new tns .
Happy Coding !!!!!