Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle TNS names not showing when adding new connection to SQL Developer

I'm trying to connect to an oracle database with SQL Developer.

I've installed the .Net oracle drivers and placed the tnsnames.ora file at
C:\Oracle\product\11.1.0\client_1\Network\Admin

I'm using the following format in tnsnames.ora:

dev =   (DESCRIPTION =     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.XXX.XXX)(PORT = XXXX))     (CONNECT_DATA =       (SERVER = DEDICATED)       (SERVICE_NAME = idpdev2)     )   ) 

In SQL Developer, when I try to create a new connection, no TNS-names show up as options.

Is there something I'm missing?

like image 840
Americus Avatar asked Jan 08 '09 16:01

Americus


People also ask

How do I add TNS entries to SQL Developer?

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.

Where do I put Tnsnames Ora in SQL Developer?

If you choose Connection Type TNS, thus forcing an install of a separate oracle client, your tnsnames. ora file goes in %ORACLE_HOME%\network\admin (for Windblows) or $ORACLE_HOME/network/admin (for (*nix).

What is TNS connection type in Oracle SQL Developer?

TNS Connections You have an Oracle client installed on your machine. You have access to many Oracle Database instances. You do not know the machine details of the system hosting the Oracle Database instance you want to connect to. A TNS connection uses an alias entry from a tnsnames.ora file.

Can't find Tnsnames Ora file?

If you have run NETCA and cannot locate the tnsnames. ora file, check to see if the tns_admin parameter has been set to specify a different directory. If you have not run NETCA, do so to create the tnsnames. ora file.


1 Answers

SQL Developer will look in the following location in this order for a tnsnames.ora file

  1. $HOME/.tnsnames.ora
  2. $TNS_ADMIN/tnsnames.ora
  3. TNS_ADMIN lookup key in the registry
  4. /etc/tnsnames.ora ( non-windows )
  5. $ORACLE_HOME/network/admin/tnsnames.ora
  6. LocalMachine\SOFTWARE\ORACLE\ORACLE_HOME_KEY
  7. 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:

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

  2. Confirm the os is recognizing this environmental variable

    From the Windows command line: echo %TNS_ADMIN%

    From linux: echo $TNS_ADMIN

  3. Restart SQL Developer

  4. 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.
like image 154
JaseAnderson Avatar answered Sep 29 '22 15:09

JaseAnderson