I was getting this error, even though I had the tns name I wanted configured. It really bugged me. I had gone through the normal things that cause this error:
- Wrong or missing entry in my tnsnames.ora file (can be found in your thin client installation ... e.g. C:\oracle\product\10.2.0\client_1\network\ADMIN\ )
- I had multiple installations of different versions of the client, but I had updated all the tnsnames files in each of these installations.
But then I noticed the detail of the error:
Fatal NI connect error 12541, connecting to:
(DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=MYDB)(CID=(PROGRAM=C:\SPBSource\myapp\trunk2\impl\target\spb#debug\mycompany\myappmanager\myapp.exe)(HOST=MYHOST)(USER=alegear)))(ADDRESS=(PROTOCOL=TCP)(HOST=10.11.16.4)(PORT=1521)))
The port it was trying to connect on was 1521 which was the wrong port for my database. My dba's had configured 1525. But had this correct port in that tnsname file, so why was it still picking up this?
Well, if it has trouble reading the tnsnames file or parts of your oracle installation, oracle will always default to port 1521 when resolving the TNS Name.
So what was wrong? Well, this will be different for everyone, but in my case I found that there is an environment variable called TNS_ADMIN. I had this pointing to a different, old and broken installation of my oracle client. So even though tnsping was working, It had trouble finding the tnsnames, so defaulted to 1521. When I repointed to a good installation and restarted the apps that used it, things were hunky dorey.
No comments:
Post a Comment