如何在 Linux 中为 ODBC 创建 DSN?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/401358/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 16:49:52  来源:igfitidea点击:

How do I create a DSN for ODBC in Linux?

sql-serverlinuxodbcdsn

提问by deadprogrammer

I am digging around in a Linux application that supposedly uses DSNs to connet to SQL Server. The connection stopped working and I can't find the credentials that are being used (all I know is the DSN's name).

我正在研究一个 Linux 应用程序,该应用程序据称使用 DSN 连接到 SQL Server。连接停止工作,我找不到正在使用的凭据(我只知道 DSN 的名称)。

I am familiar with DSNs in Windows, but how are they created and where are they stored in Linux?

我熟悉 Windows 中的 DSN,但它们是如何创建的以及它们在 Linux 中的存储位置?

回答by adilei

Simply look for your odbc.ini file. By default it should be under /etc, but I guess it can differ from one Linux flavour to another.

只需查找您的 odbc.ini 文件。默认情况下它应该在 /etc 下,但我想它可能因一种 Linux 风格而异。

Thisis a generalized guide for Linux/Unix.

是 Linux/Unix 的通用指南。

Hope this helps.

希望这可以帮助。

回答by initzero

For unixODBC, DSNs are listed in /usr/local/etc/odbc.ini. Installed ODBC drivers will be listed in /usr/local/etc/odbcinst.ini.

对于 unixODBC,DSN 列在/usr/local/etc/odbc.ini. 安装的 ODBC 驱动程序将列在/usr/local/etc/odbcinst.ini.

Try:

尝试:

usr$ find . -iname 'odbc*.ini'