Fixing the Oracle Connection Error: ORA-12154

Á

Álvaro Moura

Last updated on Jul 6, 2026

Fixing the Oracle Connection Error: ORA-12154: TNS:could not resolve the connect identifier specified

To fix this error when connecting to an Oracle database, follow the steps below:

1. Create the tnsnames.ora file

Create a file named tnsnames.ora with the following content:

REALDB =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = YOUR_IP_OR_HOST)(PORT = YOUR_PORT))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = YOUR_SERVICE_NAME)

)

)

Warning

Replace YOUR_IP_OR_HOST, YOUR_PORT, and YOUR_SERVICE_NAME with the actual connection details.

2. Save it to the correct directory

Save the file to the following path:

C:\instantclient_19_6\network\admin

![Warning](https://static.zohocdn.com/zoho-desk-editor/static/images/caution.png/)If the network and admin folders do not exist, create them manually.

3. Set environment variables in Windows

Go to:
Control Panel → System → Advanced system settings → Environment Variables

Add or edit the following System Variables:

Add or edit the following environment variables:

  • TNS_ADMIN
    Name: TNS_ADMIN
    Value C:\instantclient_19_6\network\admin
  • ORACLE_HOME
    Name: ORACLE_HOME
    Vakue: C:\instantclient_19_6

4. Edit the Apache configuration

Open the file:

C:\Program Files\NetMake\v9-php81\components\apache\conf\httpd.conf

Add the following lines:

FcgidInitialEnv TNS_ADMIN "C:/instantclient_19_6/network/admin"

FcgidInitialEnv ORACLE_HOME "C:/instantclient_19_6"

These lines should be inserted between the FcgidMaxRequestLen and Timeout directives.

5. Apply the environment setup

- Save the httpd.conf file after adding the FcgidInitialEnv variables.
- Restart your computer so the environment variables (TNS_ADMIN and ORACLE_HOME) are correctly applied.

6. Create the connection in Scriptcase

- pen Scriptcase and go to the database connection creation screen.
- Select the desired Oracle driver.
- In the "Database" field, enter the name defined in the tnsnames.ora file (e.g., REALDB).

If everything is configured correctly, the connection to the Oracle database will be established successfully.