Connecting Using a TNSNAMES.ORA Connection Alias

If your database is in the Oracle Cloud go to Connecting to Oracle Autonomous Database (ADB). For additional help using the connection dialog, visit the connection dialog help.

  1. Copy the TNSNAMES.ORA file that you want to use into the directory that is set as Config Files Folder in the Oracle Developer Tools for VS Code Extension Settings, or change this setting as desired. By default this location is ~/Oracle/network/admin on Linux and Mac and %USERPROFILE%\Oracle\network\admin on Windows.

  2. If you don't have a TNSNAMES.ORA but would like to create one, see the example located in ~/.vscode/extensions/oracle.oracledevtools-21.7.1/sample/network on Linux and Mac and %USERPROFILE%\.vscode\extensions\oracle.oracledevtools-21.7.1\sample\network on Windows .

  3. You can connect to the Oracle Database using one of the following ways:

    • To connect to Oracle Database from a .SQL or .PL/SQL file, press F1 to open Command Palette and select Oracle:Connect from the dropdown. Then select New Connection.

      Or,

    • To connect from Oracle Database Explorer, click the plus (+) sign:

  4. A connection dialog will open. In the Connection Type dropdown, select Use TNSNAMES.ORA.

  5. Make sure the TNS Admin Location field is set to the directory where your TNSNAMES.ORA file is located. If not, change it.

  6. Select an alias from the TNS Alias dropdown list.

  7. Select the database role from the Role drop down list.

  8. Enter the username and password.

  9. If you are using Proxy Authentication, check the Show more options checkbox and provide the proxy username and password. To guide you in entering the fields, note that in other tools, you may have connected using this format:

    proxyusername[username]/[proxypassword]

    Note:

    For more details about connecting with a proxy, see Connecting Using a Proxy User.

  10. If you wish to use a different schema than the default schema associated with your username, check the Show more options checkbox and select the schema name from the Current Schema dropdown.

  11. Provide a connection name to be used to reference this connection in Database Explorer and elsewhere.

  12. Click the Create Connection button.

Note:

Connection information and settings may be stored with a User, Workspace, or Folder Scope. For more information see Organizing Connections by User, Workspace, or Folder Scope.