在 Mac M1 上从 erlang 调用加载 Snowflake ODBC 驱动程序时出错:odbc.connect
Posted
技术标签:
【中文标题】在 Mac M1 上从 erlang 调用加载 Snowflake ODBC 驱动程序时出错:odbc.connect【英文标题】:Error loading Snowflake ODBC Driver on Mac M1 from erlang call :odbc.connect 【发布时间】:2021-12-07 16:11:29 【问题描述】:我在 arm64 Mac m1 上的 elixir 应用程序中加载雪花驱动程序时遇到问题(在 x86 上它工作顺利)。 已安装:
unixodbc 带有 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?
【问题讨论】:
【参考方案1】:Snowflake 提供的 ODBC 驱动程序尚不支持 M1 的 ARM 处理器。
【讨论】:
谢谢,你知道我在哪里可以查看未来支持它的计划吗? 我也想知道是否/何时支持 arm64 @Srinath-menon以上是关于在 Mac M1 上从 erlang 调用加载 Snowflake ODBC 驱动程序时出错:odbc.connect的主要内容,如果未能解决你的问题,请参考以下文章
Android Emulator 在 M1 mac/Apple Silicon 上卡住了加载屏幕
IDEA快速实现Docker镜像部署运行(for mac M1)
在 mac 上从 1.1 降级到 OPENSSL 版本 1.0
Mac M1 未加载 Openssl 库(未加载库:/usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib)