Why do I get error "ORA-12154: TNS:could not resolve the connect identifier specified" when using the Oracle ODBC driver?

This error indicates that Oracle is unable to locate the service name specified in your Oracle ODBC driver data source. Check the Database attribute value in the data source.

If you're using the standard Oracle client, the Database attribute value must specify a valid tnsnames.ora service name. For example, for the following tnsnames.ora entry, the Database attribute value needs to be my_database:

my_database =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = my_host)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = my_database)
    )
  )

If you're using the Instant Client without a tnsnames.ora file, the Database attribute value needs to be a SQL connect URL rather than a service name:

//host:port/service_name

where host is the host name or IP address of the Oracle database server, port is the Oracle listener port, and service_name is the service name. For example:

//my_host:1521/my_database

If you want to use the Instant Client with a tnsnames.ora file, the Database attribute value must specify a tnsnames.ora service name and you need to set and export the TNS_ADMIN environment variable. Set TNS_ADMIN to specify the location of the tnsnames.ora file. For example:

TNS_ADMIN = /home/oracle/network/admin
export TNS_ADMIN