尝试在ubuntu中使用RODBC连接到ODBC服务器

问题描述:

我遇到了错误:

 [RODBC] ERROR: state 01000, code 0, message [unixODBC][Driver Manager]Can't open lib 'SQL Server' : file not found
 2: In odbcDriverConnect("driver={SQL Server};server=*******;database=****;trusted_connection=true") :
 ODBC connection failed

任何人都可以提供有关安装ODBC驱动程序以使其与RODBC一起使用的详细说明吗?

Can anyone provide detailed instructions on installing the driver for ODBC in order for it to work with RODBC?

注意:我正在尝试连接到MSSQL Server

Note: I am trying to connect to an MSSQL Server

在我的工作中,我们使用Centos 5.8.当我需要连接到我们的MS-SQL服务器时,我使用FreeTDS驱动程序.我在这里再详细介绍一下: https://*.com/a/10196098/1332389 ,包括软件包和我安装的依赖项.

Here at my job, we use Centos 5.8. When I need to connect to our MS-SQL servers, I use FreeTDS drivers. I talk a bit more about it here: https://*.com/a/10196098/1332389, including the packages and dependencies that I installed.

示例连接字符串可能如下所示:

A sample connection string might look like this:

data_odbc <- odbcDriverConnect(connection="Driver=FreeTDS;
                                           Server=dataserver1\\instancename(default: master);
                                           Port=1433;        
                                           Database=database_01;
                                           Uid=data_mgmt;
                                           Pwd=placeholder")

我们将odbcinst.ini文件(在/etc/中)配置为:

We configured our odbcinst.ini file (in /etc/) to say:

# FreeTDS Drivers
# Manual setup, used for MS SQL
[FreeTDS]
Description     = FreeTDS for MSSQL
# 32 bit
Driver          = /usr/lib/libtdsodbc.so
Setup           = /usr/lib/libtdsS.so
# 64 bit
Driver64        = /usr/lib64/libtdsodbc.so
Setup64         = /usr/lib64/libtdsS.so
FileUsage = 1

自设置以来,我没有任何问题.希望这会有所帮助-如果您还有其他问题,我可以尝试回答.

I've had no issues since getting it set up. Hope this helps - I can try and answer if you have more questions.