错误加载雪花ODBC驱动程序在Mac M1上从erlang调用:odbc.connect

sh7euo9m  于 2022-12-08  发布在  Erlang
关注(0)|答案(3)|浏览(255)

我在arm64 Mac M1上的酏剂应用程序中加载雪花驱动程序有问题(在x86上工作顺利)。已安装:

  • Unix数据中心
  • 支持odbc的Erlang 24.1.2
  • 雪花驱动器
  • iODBC接口
  • ODBC管理器和iODBC管理器

下面是我的odbc安装的配置。

➜  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

我可以通过isql连接,iodbctest失败,我的简单测试用例失败:

defmodule Sandbox.OdbcTest do
use Sandbox.OdbcCase

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

我尝试连接字符串为: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

我担心来自iodbstest的消息解释了一切,但我希望有解决方案。我关注了这些文章: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?

dsf9zpds

dsf9zpds1#

Snowflake提供的ODBC驱动程序尚不支持M1的ARM处理器。

hlswsv35

hlswsv352#

Snowflake ODBC驱动程序现在支持ARM/M1,您可以从Snowflake Client Repository下载该驱动程序

bpzcxfmw

bpzcxfmw3#

我为R设计了一个类似的版本。您可以使用类似的方法:https://stackoverflow.com/a/71790445/4319571

相关问题