Oracle errors: ORA-12154: TNS:could not resolve service name - Parenthesis problem
Firstly, happy new year to everyone. I can't believe I've not written anything here since August.
Anyways, as a great start to my new year, I have been trying to run a console application that connects to an Oracle database but I keep getting the ORA-12154:
TNS:could not resolve service name error. Nothing had changed in my tnsnames.ora file and when I ran the console application from an older archived branch it would connect fine.
I could also connect fine through Toad, so there was definitely nothing wrong with the tnsnames.ora file. I even checked access permissions on the local folder so make sure that my app had the rights to that folder. And it was all 100% ok.
After about a day of debugging connection code and trying to see where the Oracle drivers somehow got corrupted, I had an idea...
Here is the folder structure on my local machine where the EXE file resided: (Notice the parenthesis)
D:\SourceCode\Development\5674 -
Online TV Guide 1(b)\Source\TVGuideImporter\bin\Debug
When I renamed the folder and removed the parenthesis, it worked. So my folder is now:
D:\SourceCode\Development\5674 -
Online TV Guide 1b\Source\TVGuideImporter\bin\Debug
Apparently, Oracle doesn't like any access to tnsnames.ora from within a folder structure that contains parenthesis. I mean that is obvious from the error message not so? ;)
After I found the solution, I did some Google work and came across this blog post explaining the same thing:
http://joeydotnet.com/blog/archive/2007/01.aspx
I hope someone else finds this post useful.