Tuesday, January 26, 2010

ORA-12154 TNS:could not resolve the connect identifier specified

Hey Oracle enthusiasts. Here's a fun one. I encounter this just about whenever I try to configure, unsuccessfully, TNSNames.ora for ODP.NET. Recently, I decided stopped worrying about TNS and put everything into the connection string, like so:

Data Source=(DESCRIPTION= (ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=LOCALHOST)(PORT=1521))) (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME = orcl))); USER ID=whatever;PASSWORD=********;"

This works every time.

It just seems as though TNS isn't worth the trouble.

4 comments:

Anonymous said...

Nice fill someone in on and this mail helped me alot in my college assignement. Say thank you you for your information.

Anonymous said...

Well I assent to but I contemplate the brief should prepare more info then it has.

Anonymous said...

Hi
Very nice and intrestingss story.

Anonymous said...

Thanks a lot for this post!
Spent the whole afternoon trying to connect my Oracle DB with powershell using the tnsnames, your trick did the trick.