Oracle TNS names not showing when adding new connection to SQL Developer
SQL Developer will look in the following location in this order for a tnsnames.ora file
- $HOME/.tnsnames.ora
- $TNS_ADMIN/tnsnames.ora
- TNS_ADMIN lookup key in the registry
- /etc/tnsnames.ora ( non-windows )
- $ORACLE_HOME/network/admin/tnsnames.ora
- LocalMachine\SOFTWARE\ORACLE\ORACLE_HOME_KEY
- LocalMachine\SOFTWARE\ORACLE\ORACLE_HOME
To see which one SQL Developer is using, issue the command show tns
in the worksheet
If your tnsnames.ora file is not getting recognized, use the following procedure:
-
Define an environmental variable called TNS_ADMIN to point to the folder that contains your tnsnames.ora file.
In Windows, this is done by navigating to Control Panel > System > Advanced system settings > Environment Variables...
In Linux, define the TNS_ADMIN variable in the .profile file in your home directory.
-
Confirm the os is recognizing this environmental variable
From the Windows command line: echo %TNS_ADMIN%
From linux: echo $TNS_ADMIN
Restart SQL Developer
- Now in SQL Developer right click on Connections and select New Connection.... Select TNS as connection type in the drop down box. Your entries from tnsnames.ora should now display here.
Open SQL Developer. Go to Tools -> Preferences -> Databases -> Advanced Then explicitly set the Tnsnames Directory
My TNSNAMES was set up correctly and I could connect to Toad, SQL*Plus etc. but I needed to do this to get SQL Developer to work. Perhaps it was a Win 7 issue as it was a pain to install too.