Toad World® Forums

Toad not displaying correct details on failed connection (14.0.0.314)

If a tnsnames file has two entries with the same alias, it appears the Oracle client uses the last one. If the last one is not valid, Toad will fail to connect (fair enough). The error window that appears shows the error message and lists things it has checked - unfortunately, the tnsnames entry it lists is the first one from the file, which isn't the one that Oracle client actually used!!

To recreate:

Put 2 different entries in the tnsnames file with the same alias but different details, e.g:

#Valid details
PW=
  (DESCRIPTION=
    (ADDRESS=(PROTOCOL=TCP)(HOST=host1)(PORT=1521))
    (CONNECT_DATA=
      (SERVICE_NAME=service1)
    )
  )

#Invalid details
PW=
  (DESCRIPTION=
    (ADDRESS=(PROTOCOL=TCP)(HOST=host2)(PORT=1521))
    (CONNECT_DATA=
      (SERVICE_NAME=service2)
    )
  )

Try to connect with Toad. It will fail (because it tried connecting with the second, invalid entry) but the error message says the address was the first one.

I won't admit to how much time I spent trying to troubleshoot a connection issue before I realised the details Toad was showing me weren't the ones it was actually using...! :wink:

1 Like

Hi,
I have had same error a few months ago, but i think it's not really a Toad error. Error is the duplicate connection with same name in tnsname.

The question is why Toad display the first one while Oracle use the last one.

With tnsnames, you can encounter other errors, when using dblinks an multiple clients.
Toad use Client's tnsnames.ora to play SQLquery, but dblinks used in the query work with server's tnsnames, if it can help...

I have logged a ticket to add a duplicate entry check to the connection error dialog.

You're right in that there shouldn't be duplicate entries in the tnsnames file, but that in itself isn't really an error. It might be nice for Toad to warn about it, but that isn't really the main problem or the fix.

The main problem is that the logic for choosing which entry to connect to is different from the logic used to choose the entry to display

Duplicate name in TNSname, random destinations ! If not full duplicate entry... But you're wright on the choice.
Oracle connect the last, good to remember...