This content has been marked as final. Show 2 replies
I believe you have found a bug. Thanks for reporting it!
Possible explanation A ...
1. You have duplicate entries in one tnsname.ora and SQL Developer is picking the wrong one (one (bad) SID, one (good) Service_Name).
2. You have multiple tnsnames.ora file (back-up version or whatever. SQL Developer used to read them all, and still may -- not sure).
Possible explanation B (my favorite) ...
1. Since you are referencing a TNS alias, the code first constructs the connection URL as starting with "jdbc:oracle:oci8:@"
2. This connection URL is constructed correctly to work for either SID or Service_Name.
3. If you don't actually have any Oracle client software (with OCI) installed, the connection attempt fails.
...I suppose there could be reasons other than missing client software for the connection failure, but regardless...
4. Any failure is trapped, and another connection attempt is made using "jdbc:oracle:thin:@"
5. This time, however, the URL construction is flawed. It always uses the format required for SID, even if Service_Name is intended.
6. Some older JDBC driver versions (not sure which) only supported the SID format, but now both formats are supported.
7. Of course, if the SID and Service_Name happen to be identical, it works anyway. Is that the case for your first CONNECT command?
I logged Bug 15931657 - FORUM - CONNECT COMMAND URL, UPON OCI FAIL-OVER TO THIN, ALWAYS USES SID FORMAT
SQL Developer Team
Is that the case for your first CONNECT command?Yes