I created a database link as follows:

CREATE PUBLIC DATABASE LINK abc
CONNECT TO scott IDENTIFIED BY tiger USING 'abc';

It created the link successfully. But when I try to use this link as follows:

SELECT * FROM tablename@abc

it shows following error:
ORA-12154: TNS:could not resolve service name

I have checked TNSNAMES.ORA. I can connect to this remote database from other places like SQL Plus. I tried by setting global_names to both TRUE and FALSE. But no use. Can somebody help me please?