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.