What does it means if the TNS_Names directory is empty in Preferences GUI of SQL Developer?
It just means that there is no tnsnames.ora file for SQL Developer to use, so you can't use TNS entries when defining connections.
It won't stop you defining other connection types - 'Basic', 'Custom JDBC' etc. - you just won't be able to use 'TNS' as there won't be any options to pick from in the 'Network alias' drop-down; and if you're previously picked one and then removed the tnsnames.ora then it won't be recognised any more.
Related
How can I export to file my Server Group configurations in Azure Data Studio?
I've created a Workspace file in my application solution that contains useful queries for troubleshooting, etc. I'd like to also include connection configurations for servers relevant to the solution so that any developer can use the Workspace queries quickly without having to ask which servers to run them on.
You can copy your Server Group configurations from User Settings. You will find them under datasource.connectionGroups and connection details under datasource.connections (if you have different ones, check with the group id). Any user can copy paste them into his user settings except the password. Everyone needs to add it after that. I would suggest to create a JSON file with those settings and add the steps to readme.md file.
All connections and groups are located in the settings.json file located at:
%AppData%\azuredatastudio\User\
For me specifically the path looked like this:
C:\Users\MyLogin123\AppData\Roaming\azuredatastudio\User
I'm working with an old Visual Basic 6 application that connects to an Oracle11g server using Remote Data Objects (RDO) 2. Here is my code:
Dim rdoCon As New rdoConnection
rdoCon.Connect = "DRIVER={Microsoft ODBC for Oracle};SERVER=os11atst.world;"
Debug.Print rdoCon.Connect '1
'Prompt the user to enter credentials and connect to the server:
rdoCon.EstablishConnection rdDriverComplete, False
Debug.Print rdoCon.Connect '2
The first Debug.Print gives me this (as expected):
DRIVER={Microsoft ODBC for Oracle};SERVER=os11atst.world;
However, the second one gives me this:
DRIVER={Microsoft ODBC for Oracle};UID=username;PWD=password;
The SERVER parameter is missing, even though the connection works fine. This is a problem for me, because I need to know what server the connection is to. I can not simply use the information from the first string, because the user is (and should be) able to change the server in the prompt that asks for username and password.
This problem arose from nowhere, possibly in connection to an upgrade from Windows XP to 7. Previously the program did not exhibit this behaviour, or so I am told by older colleagues. Not 100% sure that is correct, though.
How can I prevent the dissaperance of the server name? Can I get the name of the server in any other way than looking at the connection string?
I am not interested in solutions that include upgrading to something newer than RDO. For external reasons I am stuck with it.
rdoCon.EstablishConnection will override whatever you had previously set.
It sounds like the problem is in the DSN that is installed on this new machine. Compare it to the DSN that was installed on the previous machine. It had a configuration that you are missing on this new machine.
I have developed a not so pretty workaround to solve this. I have a table called SETTINGS containing columns NAME and VALUE. For every database I have simply added the setting servername together with the appropriate value. All I need to do to find out what server I am connected to is then to query the DB:
SELECT value FROM settings WHERE name = 'servername'
This is of course quite an ugly hack, so any better solutions would be welcome.
I use sql-developer to connect to several different oracle databases with several different users. The connection info is kept in a tnsnames.ora file so that when a database changes servers, I don't have to manually update all my connections to it. I recently updated my tnsnames file, and now there are 2 entries in the network alias list for each one that should be there. The 2nd entry appears to work (IE passes the test when I test the connection). However, by default, it seems to choose the first entry, which doesn't work.
I suspect this is due to the answer here: Oracle TNS names not showing when adding new connection to SQL Developer however, that answer doesn't address how to fix that problem.
So, how do I completely clear the network alias list and force it to re-load from the file?
It was grabbing an old copy of tnsnames.ora_OLD that I had in the same folder. According to:
http://forums.oracle.com/forums/thread.jspa?threadID=1017751
"There is a longstanding feature with SQL Developer's TNS Names functionality where SQL Developer will find all of the matching tnsnames.ora* files in the TNS Admin directory and list the contents of all of them. For example, all of the TNS aliases defined in TNSNAMES.ORA, TNSNAMES.ORA~ and TNSNAMES.ORA.201001210957 will be included in the Network Alias list."
Deleting that old file removed the extra entries.
I found that duplicated TNS names came from following two files;
tnsnames.ora AND tnsnames.~ora
Two options;
option 1. delete file " tnsnames.~ora"
option 2. if you have to keep this " tnsnames.~ora" in the folder, then rename it to like "tnsnames~ora.txt"
** Please note, if you rename it "tnsnames.~ora.txt", it will still shows duplicated.
My understanding is that if filename start with "tnsnames" and ends with "ora",
it will gives you duplicated TNS names.
I realise there are some similar questions on here already but I couldn't see one that matched my problem so I'm afraid I had to ask a new question.
I have a webservice running on a server, which is throwing a ORA-12154: TNS:could not resolve the connect identifier specified" error. However when I log onto the said server i am able to tnsping the entry successfully, and connect to it via sqlplus, but not through the webservice.
If anyone has any suggestions as to things to look for then I would greatly appreciate it.
Cheers
Some other things to look at include:
If you're using a service name instead of SID, are you specifying the entire service name?
If you're using the ORACLE_SID environmental variable, check the case (mydb vs MYDB)
Check for a sqlnet.log file
If you're using a username/password#SID connect string, you may need to quote your password if it contains special characters (like an # symbol).
The webservice can't find tnsnames.ora which usually means that you didn't set up Oracle's environment properly when starting the process. This usually means you didn't source oraenv.sh in the shell script which starts it.
So your interactive login works - what is different between your interactive login and the user that runs your web service?
Are they the same user? If not then you will need to update some of your configs in order to make the Oracle client files available to the webservice.
Details like Operating System, Oracle Version, etc are always a help.
I've been wondering this for a while but since it hasn't come up much I've left it in the 'mysterious wizardy' column.
It seems to me that there is some sort of relationship between a connection identifier like ABC and ABC.DEFG and I don't quite get what it is.
For example, a machine I was setting up just now I was having problems with using the identfier ED2 even though in my tnsnames file I clearly had
EDC2 = (....)
This was copied and pasted from another computer which worked just fine. However, doing tnsping EDC2 would fail to resolve until I changed it to say
EDC2.WORLD = (...)
at which point resolving to EDC2 started working. What is going on here?
The TNS alias in the tnsnames.ora file interacts with the parameter
NAMES.DEFAULT_DOMAIN
in the sqlnet.ora file. If NAMES.DEFAULT_DOMAIN is set to WORLD, for example, then when you try to connect to an alias without a domain, the sqlnet.ora file tells Oracle to automatically append the domain before doing the lookup in the tnsnames.ora file. If you try to connect to an alias with a domain, NAMES.DEFAULT_DOMAIN is ignored.
My general preference/ suggestion is to set NAMES.DEFAULT_DOMAIN to WORLD in the sqlnet.ora and specify EDC2.WORLD in the tnsnames.ora file. That way, both the connect identifier EDC2 and EDC2.WORLD will work-- the former gets changed to the latter because of the DEFAULT_DOMAIN parameter.