Use tnsnames.ora in Oracle SQL Developer

后端 未结 5 1742
野趣味
野趣味 2020-12-12 14:33

I am evaluating Oracle SQL Developer.

My tnsnames.ora is populated, and a tnsping to a connection defined in tnsnames.ora work

相关标签:
5条回答
  • 2020-12-12 15:09

    This excellent answer to a similar question (that I could not find before, unfortunately) helped me solve the problem.

    Copying Content from referenced answer :

    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

    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.

    0 讨论(0)
  • 2020-12-12 15:09

    On the newer versions of macOS, one also has to set java.library.path. The easiest/safest way to do that [1] is by creating ~/.sqldeveloper/<version>/sqldeveloper.conf file and populating it as such:

    AddVMOption -Djava.library.path=<instant client directory>
    

    [1] https://community.oracle.com/message/14132189#14132189

    0 讨论(0)
  • 2020-12-12 15:14

    I had the same problem, tnsnames.ora worked fine for all other tools but SQL Developer would not use it. I tried all the suggestions on the web I could find, including the solutions on the link provided here.
    Nothing worked.

    It turns out that the database was caching backup copies of tnsnames.ora like tnsnames.ora.bk2, tnsnames09042811AM4501.bak, tnsnames.ora.bk etc. These files were not readable by the average user.

    I suspect sqldeveloper is pattern matching for the name and it was trying to read one of these backup copies and couldn't. So it just fails gracefully and shows nothing in drop down list.

    The solution is to make all the files readable or delete or move the backup copies out of the Admin directory.

    0 讨论(0)
  • 2020-12-12 15:17
    • In SQLDeveloper browse Tools --> Preferences, as shown in below image.

      SQLDeveloper access preferences

    • In the Preferences options expand Database --> select Advanced --> under "Tnsnames Directory" --> Browse the directory where tnsnames.ora present.
    • Then click on Ok, as shown in below diagram.
      tnsnames.ora available at Drive:\oracle\product\10x.x.x\client_x\NETWORK\ADMIN

      SQLDeveloper update tnsnames directory

    Now you can connect via the TNSnames options.

    0 讨论(0)
  • 2020-12-12 15:19

    This helped me:

    Posted: 8/12/2011 4:54

    Set tnsnames directory tools->Preferences->Database->advanced->Tnsnames Directory

    https://forums.oracle.com/forums/thread.jspa?messageID=10020012&#10020012

    0 讨论(0)
提交回复
热议问题