**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](https://static.zohocdn.com/zoho-desk-editor/static/images/caution.png/)

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**:

**![](https://help.scriptcase.net/galleryDocuments/edbsn21e50ecd7b0181467dfec22926830f479e5db5baad9de8f8bb257e2e0d962d1558e30e57db5ffb1d2eb4e68a5d8bf340?inline=true)**

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.
```