ole
ole

Reputation: 51

Error loading Snowflake ODBC Driver on Mac M1 from erlang call :odbc.connect

I have a problem with loading snowflake driver in the elixir application on arm64 Mac m1 (on x86 it works smoothly). Installed:

Below is configuration of my odbc installation


    ➜  sandbox odbcinst -j
    unixODBC 2.3.9
    DRIVERS............: /usr/local/etc/odbcinst.ini
    SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini
    FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources
    USER DATA SOURCES..: /Users/or/.odbc.ini
    SQLULEN Size.......: 8
    SQLLEN Size........: 8
    SQLSETPOSIROW Size.: 8

    ➜  sandbox cat /usr/local/etc/odbcinst.ini
    [ODBC Drivers]
    SnowflakeDSIIDriver=Installed

    [SnowflakeDSIIDriver]
    APILevel=1
    ConnectFunctions=YYY
    Description=Snowflake DSII
    Driver=/opt/snowflake/snowflakeodbc/lib/universal/libSnowflake.dylib
    DriverODBCVer=03.52
    SQLLevel=1

    ODBCInstLib=/usr/local/iODBC/lib/libiodbcinst.dylib



    ➜  sandbox cat /opt/snowflake/snowflakeodbc/lib/universal/simba.snowflake.ini
    [Driver]
    ANSIENCODING=UTF-8
    DriverManagerEncoding=UTF-32
    DriverLocale=en-US
    ErrorMessagesPath=/opt/snowflake/snowflakeodbc/ErrorMessages
    LogLevel=0
    LogPath=
    CURLVerboseMode=false
    CABundleFile=/opt/snowflake/snowflakeodbc/lib/universal/cacert.pem

    ODBCInstLib=libodbcinst.dylib


➜  sandbox cat /usr/local/etc/odbc.ini
[ODBC Data Sources]
SNOWFLAKE_ODBC = SnowflakeDSIIDriver

[SNOWFLAKE_ODBC]
Driver      = /opt/snowflake/snowflakeodbc/lib/universal/libSnowflake.dylib
Description =  Internal Snowflake
uid         = <>
server      = MY_SERVER
database    = <>
schema      = <>
warehouse   = <>
role        = MY_ROLE
tracing     = 6
➜  sandbox 

➜  sandbox odbcinst -s -q                                                          
[SNOWFLAKE_ODBC]



➜  sandbox isql -v SNOWFLAKE_ODBC <USERNAME> <PASSWORD>          
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> 


➜  sandbox /usr/local/iODBC/bin/iodbctest                                        
iODBC Demonstration program
This program shows an interactive SQL processor
Driver Manager: 03.52.1521.0607

Enter ODBC connect string (? shows list): 

DSN                              | Driver                                  
------------------------------------------------------------------------------
SnowflakeDSII                    | Snowflake                               

Enter ODBC connect string (? shows list): SnowflakeDSII
1: SQLDriverConnect = [iODBC][Driver Manager]dlopen(/opt/snowflake/snowflakeodbc/lib/universal/libSnowflake.dylib, 6): no suitable image found.  Did find:
    /opt/snowflake/snowflakeodbc/lib/universal/libSnowflake.dylib: no matching architecture in universal wrapper
    /opt/snowfl (0) SQLSTATE=00000
2: SQLDriverConnect = [iODBC][Driver Manager]Specified driver could not be loaded (0) SQLSTATE=IM003

I can connect via isql, iodbctest fails and my simple test case fails:

defmodule Sandbox.OdbcTest do
use Sandbox.OdbcCase


test "test odbc" do
    conn_str = 'dsn=SnowflakeDSII'
    IO.inspect :odbc.connect(conn_str, [])
end
end

I tried connection string as: conn_str = 'driver=/opt/snowflake/snowflakeodbc/lib/universal/libSnowflake.dylib;server=<SERVER>;uid=<USERNAME>;pwd=<PASSWORD>;role=<ROLE>;warehouse=TEST_WH;'

➜  sandbox mix test test/odbc_test.exs                                           
true
'driver=/opt/snowflake/snowflakeodbc/lib/universal/libSnowflake.dylib;<MY_DSN>'
{:error,
 '[unixODBC][Driver Manager]Can\'t open lib \'/opt/snowflake/snowflakeodbc/lib/universal/libSnowflake.dylib\' : file not found SQLSTATE IS: 01000 Connection to database failed.'}
.

Finished in 0.05 seconds (0.00s async, 0.05s sync)
1 test, 0 failures

Randomized with seed 529170

I am afraid message from iodbstest explains everything but I hope there is solution. I followed these articles: https://docs.snowflake.com/en/user-guide/odbc-mac.html

https://community.snowflake.com/s/article/How-to-create-Snowflake-ODBC-DSN-On-MacOS

How do I install the ODBC driver for Snowflake successfully on an M1 Apple Silicon Mac?

Upvotes: 5

Views: 2017

Answers (3)

dhana
dhana

Reputation: 11

Snowflake ODBC Driver support for ARM/M1 is now available, and you can download the driver from the Snowflake Client Repository

Upvotes: 1

Scott Brenstuhl
Scott Brenstuhl

Reputation: 617

I got a version of this working for R. You might be able to leverage a similar approach: https://stackoverflow.com/a/71790445/4319571

Upvotes: 0

Srinath Menon
Srinath Menon

Reputation: 1640

ARM processor for M1 is not yet supported for ODBC drivers provided by Snowflake.

Upvotes: 3

Related Questions