UnixODBC / Oracle: how can I specify all information about data sources in the connection string ONLY, and not in odbc * .ini files

I want to connect to Oracle (11g) using unixODBC. I want the connection string ONLY to indicate all the information about the database / data source, and the ODBC INI files ( /etc/odbc.iniand /etc/odbcinst.ini) contain only general information about the driver, for example, where to find ".so", etc., ie I want them to be static. I want to do this so that I can get the connection string from the user from outside and connect to the data source without having to change any INI files or any other configuration on the disk.

All the examples I've seen allow me to define server information in the /etc/odbc.inifollowing way:

[myDSNname]
Driver = OracleODBC-11g
DSN = OracleODBC-11g
ServerName = //xxx.xxx.xxx.xxx:1521/SID_NAME
UserID = my_user
Password = my_pass

Now I figured out how to get UserID and Password from the connection string by adding "UID=my_user;PWD=my_pass"to the connection string, and I deleted them from odbc.ini. My joy quickly passed when I could not find a way to get ServerNamefrom odbc.iniand to the connection string. So how do I do this? And is there a way to completely get rid of the DSN in odbc.iniand only have Driverthe odbcinst.iniin connection string, as we do for MySQL?

Edit: Attempting any of the connection strings www.connectionstrings.com that don't seem to require TNS or DSN, including options EZCONNECT, all give me

[HY000] [unixODBC][Oracle][ODBC][Ora]ORA-12162: TNS:net service name is incorrectly specified
    (12162) (SQLDriverConnectW)
+5
source share
1 answer

just use dbq = address: 1521 / orcl and you get what you want

+5
source

All Articles