KNOWLEDGE BASE

Error "IO Error: The Network Adapter could not establish the connection" Occurs When Connecting to Oracle Using Net Service Name(TNSNames.ora)


Published: 05 Apr 2022
Last Modified Date: 07 Apr 2022

Issue

When connecting to Oracle from Tableau Desktop or Tableau Prep, the error below occurs and is unable to connect to Oracle.

"IO Error: The Network Adapter could not establish the connection

Unable to connect to the Oracle server "<server>". Check that the server is running and that you have access privileges to the requested database."
 

When the issue occurs, the below error was found in jprotocolserver.log.
”Caused by: java.net.UnknownHostException: Unknown Host Name (XXXX)

Environment

  • Tableau Desktop
  • Tableau Prep Builder
  • Oracle

Resolution

Please set the TNS_Admin environment variable when using Net Service Name(TNSNames.ora)

For Windows:
1. Select Start > Control Panel > System 
2. Select Advanced System Settings
3. In the System Properties dialog box, on the Advanced tab, select Environment Variables. 
4. Under System Variables, click New. 
5. In the New System Variable dialog box, enter the following, then click OK: 
  • Variable name: TNS_ADMIN 
  • Variable value: the directory containing the TNSNames.ora file.
6. Click OK in the Environment Variables dialog box and the System Properties dialog box. 
7. Restart Tableau Desktop or Tableau Prep to ensure that the new variable is recognized. 

For Mac:
1. Start Terminal and type the following command:
sudo nano /etc/launchd.conf
2. Type your password when prompted.
3. Type the following:
launch setenv TNS_ADMIN /etc
4. Press Ctrl-X, then Y, then Enter to save changes and exit nano.
5. Restart your Mac.

Cause

The environment variable for TNS_ADMIN is not set in the machine's environment.
Did this article resolve the issue?