ODBC fails on Apple Silicon
I have a problem with connecting to IRIS via ODBC on Apple Silicon.
I installed unixodbc with brew, and downloaded ODBC-2023.1.0.229.0-macos.tar.gz from the community github repo.
After setting up odbc.ini so that libirisodbcur6435.so that was just downloaded is used as the driver, isql fails as follows:
$ isql -v sampleodbc[08S01][unixODBC][Iris ODBC][State : 08S01][Native Code 459][libirisodbcur6435.so]Connection via irisconnect failed:getaddrinfo(, , 0, 0) failed in s_TCPConnect, reason = nodename nor servname provided, or not known.[ISQL]ERROR: Could not SQLConnect
Can anyone tell me what I am doing wrong ? The macOS version is Ventura 13.3.1 (a).
Thanks.
Comments
I suggest that you open a Support ticket with the WRC if you don't get a good answer quickly here.
I do not have an Apple Silicon Mac but I have worked with the ODBC driver on various Unix platforms and these sort of problems are typically because of where the libirisodbcur6435.so driver looks to get its configuration files vs. where the driver manager (in this case, unixODBC) looks for its configuration. Also, how have you installed the libirisodbcur6435.so driver? Is it part of a "stand-alone" ODBC kit or part of a server installation?
You can determine where unixODBC tries to find its configuration files by running:
odbcinst -j
which on my Intel Mac system returns:
unixODBC 2.3.7 DRIVERS............: /opt/local/etc/odbcinst.ini SYSTEM DATA SOURCES: /opt/local/etc/odbc.ini FILE DATA SOURCES..: /opt/local/etc/ODBCDataSources USER DATA SOURCES..: /Users/mburstin/.odbc.ini SQLULEN Size.......: 8 SQLLEN Size........: 8 SQLSETPOSIROW Size.: 8
Meaning that it looks to find its DSN configuration in /opt/local/etc/odbc.ini. I have found that the odbc driver sometimes wants to get its configuration information from a different location. You typically can either create a symbolic link to that file (I will explain below how to find that) or by setting the ODBCINI environment variable to point to the odbc.ini file that the driver manager us using it which will force libirisodbcur6435.so to use that file.
To determine where libirisodbcur6435.so driver is searching, you can use the following in one macOS terminal:
sudo fs_usage isql | grep ini
while running your isql command from above which will generate output looking like this:
11:02:10 stat64 /usr/lib/system/libsystem_secinit.dylib 0.000002 isql 11:02:10 open /opt/local/etc/odbcinst.ini 0.000029 isql 11:02:10 open /Users/mburstin/.odbcinst.ini 0.000007 isql 11:02:10 open /opt/local/etc/odbcinst.ini 0.000021 isql 11:02:10 open /Users/mburstin/.odbcinst.ini 0.000005 isql 11:02:10 open /opt/local/etc/odbcinst.ini 0.000019 isql 11:02:10 open /Users/mburstin/.odbcinst.ini 0.000004 isql 11:02:10 open /opt/local/etc/odbcinst.ini 0.000019 isql 11:02:10 open /Users/mburstin/.odbcinst.ini 0.000005 isql 11:02:10 open /Applications/ISC/mikebsql/mgr/irisodbc.ini 0.000063 isql 11:02:10 open /Applications/ISC/mikebsql/mgr/irisodbc.ini 0.000032 isql
Meaning that my driver (installed in /Applications/ISC/mikebsql) is looking for a file /Applications/ISC/mikebsql/mgr/irisodbc.ini
@Michael Burstin to clarify, is it more accurate to say that the driver is looking for settings in all the .ini files listed in the above output? And do all the file locations output by odbcinst -j need to be present in the fs_usage isql output?
I installed the driver by downloading ODBC-2023.1.0.229.0-macos.tar.gz from the community github repo. I am not sure *-macos.tar.gz is for Apple Silicon.
odbcinst -j gives:
$ odbcinst -junixODBC 2.3.11DRIVERS............: /opt/homebrew/etc/odbcinst.iniSYSTEM DATA SOURCES: /opt/homebrew/etc/odbc.iniFILE DATA SOURCES..: /opt/homebrew/etc/ODBCDataSourcesUSER DATA SOURCES..: /Users/horita/.odbc.iniSQLULEN Size.......: 8SQLLEN Size........: 8SQLSETPOSIROW Size.: 8and sudo fs_usage isql | grep ini :
so it looks like the driver is reading the correct configuration files.
The log file shows:
and this looks like the problem. The error was the same in both HOST=localhost and HOST=127.0.0.1.