Using Oracle TNS Names
All information for connecting to an Oracle database may be stored in a tnsnames.ora file, with each database instance defined by a TNS alias. If you want to create a connection in DbVisualizer that uses the information from this file, you must first tell DbVisualizer where it is stored by setting either the TNS_ADMIN
environment variable to the path of the folder holding the file, or making sure it is located in the ORACLE_HOME/network/admin folder and that the ORACLE_HOME
environment variable is set.
If a tnsnames.ora file cannot be found when clicking the TNS Alias drop-down, the following is displayed:
"If you like to use TNS aliases there are 2 options:
- The tnsnames.ora file must be located either in the ORACLE_HOME/network/admin directory or in a directory identified by the TNS_ADMIN environment variable
- Specify the
-Doracle.net.tns_admin=<folder-containing-tnsnames.ora>
Java VM Property in Tools->Tool Properties under the General tab
For general information about TNS in Oracle, see the Local Naming Parameters (tnsnames.ora) chapter in the Oracle Database Net Services Reference."
When this configuration is done, you can select TNS from the Connection Type list for the Oracle connection and then pick the TNS alias from a list of all aliases found in the file.
On macOS, environment variables set in .bash_profile
or similar are not available to applications started via Spotlight or by double-clicking an app icon. The launchctl
command can be used to set these environment variables instead, for instance from the .bash_profile
script. This thread discusses an alternative solutions for Yosemite and El Capitan: