Question
· May 19, 2023

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. 

Product version: IRIS 2023.1
$ZV: IRIS for UNIX (Apple macOS for Apple Silicon) 2023.1 (Build 229U) Fri Apr 14 2023 17:16:20 EDT
Discussion (4)4
Log in or sign up to continue

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

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 -j
unixODBC 2.3.11
DRIVERS............: /opt/homebrew/etc/odbcinst.ini
SYSTEM DATA SOURCES: /opt/homebrew/etc/odbc.ini
FILE DATA SOURCES..: /opt/homebrew/etc/ODBCDataSources
USER DATA SOURCES..: /Users/horita/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

and sudo fs_usage isql | grep ini :

15:36:23  open              /opt/homebrew/etc/odbcinst.ini                                                   0.000021   isql        
15:36:23  open              /Users/horita/.odbcinst.ini                                                      0.000012   isql        
15:36:23  open              /opt/homebrew/etc/odbcinst.ini                                                   0.000021   isql        
15:36:23  open              /Users/horita/.odbcinst.ini                                                      0.000003   isql        
15:36:23  open              /Users/horita/.odbc.ini                                                          0.000024   isql        
15:36:23  open              /Users/horita/.odbc.ini                                                          0.000011   isql        
15:36:23  open              /opt/homebrew/etc/odbc.ini                                                       0.000015   isql        
15:36:23  open              /opt/homebrew/etc/odbc.ini                                                       0.000011   isql        
15:36:23  open              /opt/homebrew/etc/odbcinst.ini                                                   0.000015   isql        
15:36:23  open              /Users/horita/.odbcinst.ini                                                      0.000003   isql        
15:36:23  open              /opt/homebrew/etc/odbcinst.ini                                                   0.000011   isql        
15:36:23  open              /Users/horita/.odbcinst.ini                                                      0.000002   isql        
15:36:23  open              /Users/horita/.odbc.ini                                                          0.000010   isql        
15:36:23  open              /Users/horita/.odbc.ini                                                          0.000010   isql        
15:36:23  open              /opt/homebrew/etc/odbc.ini                                                       0.000010   isql        
15:36:23  open              /opt/homebrew/etc/odbc.ini                                                       0.000009   isql        
15:36:23  open              /Users/horita/.odbc.ini                                                          0.000010   isql        
15:36:23  open              /Users/horita/.odbc.ini                                                          0.000009   isql        
15:36:23  open              /opt/homebrew/etc/odbc.ini                                                       0.000009   isql        
15:36:23  open              /opt/homebrew/etc/odbc.ini                                                       0.000009   isql        
15:36:23  open              /Users/horita/.odbc.ini                                                          0.000009   isql        
15:36:23  open              /Users/horita/.odbc.ini                                                          0.000008   isql        
15:36:23  open              /opt/homebrew/etc/odbc.ini                                                       0.000009   isql        
15:36:23  open              /opt/homebrew/etc/odbc.ini                                                       0.000008   isql        
15:36:23  open              /opt/homebrew/etc/odbcinst.ini                                                   0.000010   isql        
15:36:23  open              /Users/horita/.odbcinst.ini                                                      0.000002   isql        
15:36:23  open              /opt/homebrew/etc/odbcinst.ini                                                   0.000009   isql        
15:36:23  open              /Users/horita/.odbcinst.ini                                                      0.000002   isql        
15:36:23  open              /opt/homebrew/etc/odbcinst.ini                                                   0.000009   isql        
15:36:23  open              /Users/horita/.odbcinst.ini                                                      0.000002   isql        
15:36:23  open              /opt/homebrew/etc/odbcinst.ini                                                   0.000010   isql        
15:36:23  open              /Users/horita/.odbcinst.ini                                                      0.000002   isql        
15:36:23  open              /opt/homebrew/etc/odbcinst.ini                                                   0.000010   isql        
15:36:23  open              /Users/horita/.odbcinst.ini                                                      0.000002   isql        
15:36:23  open              /opt/homebrew/etc/odbcinst.ini                                                   0.000009   isql        
15:36:23  open              /Users/horita/.odbcinst.ini                                                      0.000002   isql        
15:36:23  open              /opt/homebrew/etc/odbcinst.ini                                                   0.000010   isql        
15:36:23  open              /Users/horita/.odbcinst.ini                                                      0.000002   isql        
15:36:23  open              /opt/homebrew/etc/odbcinst.ini                                                   0.000010   isql        
15:36:23  open              /Users/horita/.odbcinst.ini                                                      0.000002   isql        
15:36:23  open              /opt/homebrew/etc/odbcinst.ini                                                   0.000008   isql        
15:36:23  open              /Users/horita/.odbcinst.ini                                                      0.000002   isql        
15:36:23  open              /opt/homebrew/etc/odbcinst.ini                                                   0.000009   isql        
15:36:23  open              /Users/horita/.odbcinst.ini                                                      0.000002   isql        
15:36:23  open              private/etc/odbc.ini                                                             0.000017   isql        
15:36:23  open              private/etc/odbc.ini                                                             0.000009   isql        
15:36:23  open              private/etc/odbc.ini                                                             0.000009   isql        
15:36:23  open              private/etc/odbc.ini                                                             0.000007   isql        
15:36:23  open              private/etc/odbc.ini                                                             0.000008   isql        
15:36:23  open              private/etc/odbc.ini                                                             0.000008   isql        

so it looks like the driver is reading the correct configuration files.

The log file shows:

--> SQLConnect: (05/22/23-15:36:23:501) hdbc = 0x138020000
    DSN: user
    USERNAME: (null)
    ERROR: Connect: (05/22/23-15:36:23:501) Connect via irisconnect returned: 0x8 , getaddrinfo(, , 0, 0) failed in s_TCPConnect, reason = nodename nor servname provided, or not known.
 
<-- SQLConnect: (05/22/23-15:36:23:501) Returning -1

and this looks like the problem. The error was the same in both HOST=localhost and HOST=127.0.0.1.