通过 ODBC 连接到 MS SQL Server

发布于 2024-09-30 04:45:04 字数 352 浏览 0 评论 0原文

我有一个 Qt 4 应用程序尝试使用 Qt ODBC 驱动程序连接到 MS SQL Server 2008 数据库。该应用程序在 Windows 中运行时运行良好;然而,应用程序的目标操作系统是在 GNU/Linux 中运行。当应用程序在 GNU/Linux 中运行时,我收到以下错误:

QSqlError(0, "QODBC3: Unable to connect", " [unixODBC][Driver Manager]Data source name not found, and no default driver specified")

是否需要在 SQL 服务器或应用程序端配置某些内容才能使连接正常工作?

I have a Qt 4 application that is trying to connect to an MS SQL Server 2008 database using the Qt ODBC driver. The application runs fine when it is running in Windows; however, the target OS for the application is to have it run in GNU/Linux. When the application runs in GNU/Linux I get the following error:

QSqlError(0, "QODBC3: Unable to connect", " [unixODBC][Driver Manager]Data source name not found, and no default driver specified")

Is there something I need to configure on the SQL server or application side to get the connection to work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冷默言语 2024-10-07 04:45:04

我对 unixODBC 不太了解,但看看这里:
unixodbc.org/doc/

对于连接到 MSSQL,以下内容可能有用:
http://www.unixodbc.org/doc/FreeTDS.html
或.../FreeTDS2.html

I don't really know much about unixODBC, but have a look here:
unixodbc.org/doc/

For connecting to MSSQL, the following might be useful:
http://www.unixodbc.org/doc/FreeTDS.html
or .../FreeTDS2.html

御守 2024-10-07 04:45:04

尝试将 odbc.ini 文件复制到 ~/.odbc.ini 中。如果再次不起作用,请尝试将同一文件复制到 /etc/odbc.ini 中。如果这不起作用,因为这些目录对于不同的 Unix 系统是不同的,请查找所有文件:*odbc*\.ini 并查看其中是否有一些为空。如果是这样,请将它们替换为正确的 .ini 文件。

我有同样的问题,这解决了它。但这是一个非常愚蠢的解决方案,所以我正在寻找更好的解决方案。希望有帮助(:

Try to copy the odbc.ini file in ~/.odbc.ini . If not working again, try to copy the same file into /etc/odbc.ini. If this is not working, as these directories are different for different Unix systems, find all files: *odbc*\.ini and see if some of them are empty. If so, replace them with the correct .ini file.

I had the same problem and this solved it. But it's a really stupid solution, so I'm looking for a better one. Hope that helped (:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文