"[unixODBC][Driver Manager]Data source name not found, and no default driver specified" when connecting to OracleDB using ODBC
Solution 1
If you have one Database to connect, then you may do following
export TWO_TASK=db_SID
you may place this in /etc/profile and your work will be done.
Solution 2
First make sure that it's an issue with environment variables.
Run these lines manually right before invoking the application. The application MUST be invoked from command line right there.
export ODBCINI=/etc/unixODBC/odbc.ini
export ODBCSYSINI=/etc/unixODBC
If that works then you can add those lines to the system-wide /etc/profile
file. Force users log-off and try again.
user1471980
Updated on September 18, 2022Comments
-
user1471980 almost 2 years
I am trying to make an odbc connection to an oracle db from linux. When I login as root, it works. My root profile is as below:
more ~/.profile export ODBCINI=/etc/unixODBC/odbc.ini export ODBCSYSINI=/etc/unixODBC
However, when I login as a regular user, I cannot do an odbc connections. I get this error:
[RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver Manager]Data source name not found, and no default driver specified
I am not sure what is the problem here but I thought maybe I make root profile available to other users it may solve my problem. How do you present root profile to all of the other users? Any ideas what might be happening here?
Additional info:
this is my tnsnames.ora file looks like:
Data = (DESCRIPTION = (ADDRESS_LIST = (LOAD_BALANCE = off) (FAILOVER = ON) (ADDRESS = (PROTOCOL = TCP)(HOST = server1.example.com )(PORT = 1521)) ) (CONNECT_DATA = (service_name = Data) ) )
this is what odbc.ini:
[Data] Driver=Oracle Description=Test Trace=Yes ServerName=//server1.example.com:1521/ Database=test
and this is ondbcinst.ini
[Oracle] Description = Oracle ODBC Connection Driver = /opt/oclient/instantclient_12_1/libsqora.so.12.1 Setup = FileUsage =
-
user1471980 almost 10 yearsok, that was one of the problem. After I did what you've recommended, I now get this error: [RODBC] ERROR: state HY000, code 12162, message [unixODBC][Oracle][ODBC][Ora]ORA-12162: TNS:net service name is incorrectly specified
-
LatinSuD almost 10 yearsTry running this as root:
set | grep ORACLE
and show what you get -
user1471980 almost 10 yearsnothing comes up
-
user1471980 almost 10 yearsI just update my post with tnsnames and odbc config info, does that help?
-
LatinSuD almost 10 yearsNot sure. I must confess i'm no Oracle expert. Can a normal user read those files without permission problems?
-
user1471980 almost 10 yearsyes, all of the files have 755
-
lord.garbage over 9 yearsYou should not answer a question and ask another one in you question. Please post your question as a new one after checking whether it already has been asked here. Also you should avoid things like "thanks" and so on as this is discouraged by Stack posting guidelines.