如何为 UnixODBC 配置默认驱动程序?
How do I configure a default driver for UnixODBC?
我想配置我的 odbc.ini
和 odbcinst.ini
文件以允许在连接未指定驱动程序时使用默认驱动程序。我假设在未指定驱动程序时给出常见错误消息是可能的:
[unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)
但是我的 DuckDuckGo-foo 让我失望了。我尝试在 odbc.ini
:
中设置 [DEFAULT]
[DEFAULT]
Driver=Snowflake
但仍然出现错误(由于 remainder of the configuration,"Snowflake" 是一个有效的驱动程序,在我指定它时可以工作。)我还尝试将 [DEFAULT]
部分添加到 odbcinst.ini
,但没有区别。
那么如何指定默认的 UnixODBC 驱动程序呢?
给出 your existing configuration files (both odbcinst.ini
and odbc.ini
), I believe you'll find success by adding the following (as described in the ODBC spec) 给 odbcinst.ini
--
[Default]
Driver=Snowflake
-- 以及以下(如 the ODBC spec 中所述)到 odbc.ini
--
[Default]
Description=SnowflakeDB
Driver=Snowflake
Locale=en-US
SERVER=SF_ACCOUNT.snowflakecomputing.com
PORT=443
SSL=on
ACCOUNT=SF_ACCOUNT
基于 discussion on @TallTed's pull request I've come to the conclusion that it is not possible to configure a default driver in the unixODBC configuration files, sadly, despite the assertions of the ODBC default driver subkey, which I think @TallTed properly interprets in their answer。也许在将来,但至少现在,我认为我只是误解了错误消息的含义:
Data source name not found, and no default driver specified
我一直假设这意味着主机上没有配置默认驱动程序。但我现在想也许,它实际上意味着"Cannot find the DSN in the URL, and there was no Driver
param to fall back on, either"。 IOW,如果找不到 DSN,Driver
参数指定默认驱动程序。
该解释与 PR 中讨论的发现一致。有点令人失望,但我认为可以通过改进错误消息或至少某种文档更新来解释如何指定默认驱动程序来解决此问题。
我想配置我的 odbc.ini
和 odbcinst.ini
文件以允许在连接未指定驱动程序时使用默认驱动程序。我假设在未指定驱动程序时给出常见错误消息是可能的:
[unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)
但是我的 DuckDuckGo-foo 让我失望了。我尝试在 odbc.ini
:
[DEFAULT]
[DEFAULT]
Driver=Snowflake
但仍然出现错误(由于 remainder of the configuration,"Snowflake" 是一个有效的驱动程序,在我指定它时可以工作。)我还尝试将 [DEFAULT]
部分添加到 odbcinst.ini
,但没有区别。
那么如何指定默认的 UnixODBC 驱动程序呢?
给出 your existing configuration files (both odbcinst.ini
and odbc.ini
), I believe you'll find success by adding the following (as described in the ODBC spec) 给 odbcinst.ini
--
[Default]
Driver=Snowflake
-- 以及以下(如 the ODBC spec 中所述)到 odbc.ini
--
[Default]
Description=SnowflakeDB
Driver=Snowflake
Locale=en-US
SERVER=SF_ACCOUNT.snowflakecomputing.com
PORT=443
SSL=on
ACCOUNT=SF_ACCOUNT
基于 discussion on @TallTed's pull request I've come to the conclusion that it is not possible to configure a default driver in the unixODBC configuration files, sadly, despite the assertions of the ODBC default driver subkey, which I think @TallTed properly interprets in their answer。也许在将来,但至少现在,我认为我只是误解了错误消息的含义:
Data source name not found, and no default driver specified
我一直假设这意味着主机上没有配置默认驱动程序。但我现在想也许,它实际上意味着"Cannot find the DSN in the URL, and there was no Driver
param to fall back on, either"。 IOW,如果找不到 DSN,Driver
参数指定默认驱动程序。
该解释与 PR 中讨论的发现一致。有点令人失望,但我认为可以通过改进错误消息或至少某种文档更新来解释如何指定默认驱动程序来解决此问题。