gpt4 book ai didi

linux - 需要帮助从 Linux (ubuntu) 连接 MSSQL SERVER

转载 作者:太空狗 更新时间:2023-10-29 11:15:36 25 4
gpt4 key购买 nike

我刚刚在 Ubuntu 中安装了 ODBC 驱动程序,但在从 Perl 连接数据库时仍然遇到问题。这是我在我的机器上所做的描述。

我从 easysoft 网站安装了 MSSQL 驱动程序和 Unix ODBC。我的机器中的路径详细信息如下:

ODBC 安装路径:- user/local/easysoft/unixodbc

数据源和驱动程序路径:user/local/etc示例代码:

#!/usr/bin/perl  
use strict;
use DBI;
my $dsn="DBI:ODBC:DRIVER={SQL Server};Server=xxx.xxx.xxx.xxx,1433;database=DB_name";
my $dbh = DBI->connect($dsn, "username", "password" ,{AutoCommit => 1} )
or die DBI::errstr;

错误:

DBI connect('DRIVER={SQL Server};Server=xxx.xxx.xxx.xxx,1433;database=DB_name','username',...) failed: unixODBCDriver Manager Can't open lib 'SQL Server' : file not found (SQL-01000) at sample.pl line 5 
unixODBCDriver ManagerCan't open lib 'SQL Server' : file not found (SQL-01000) at sample.pl line 5.

最佳答案

DRIVER={SQL Server}

您的代码正在尝试连接到 odbcinst.ini 文件中的 [SQL Server] 驱动程序。但是,如果您使用的是 Easysoft ODBC-SQL Server Driver您将需要使用:-

Driver={Easysoft ODBC-SQL Server}

关于linux - 需要帮助从 Linux (ubuntu) 连接 MSSQL SERVER,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12455455/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com