首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Linux Ubuntu上配置freetds和unixodbc

如何在Linux Ubuntu上配置freetds和unixodbc
EN

Stack Overflow用户
提问于 2015-05-08 15:48:03
回答 1查看 4.4K关注 0票数 3

我试图在Linux上用freetds + unixodbc与Windows上的数据库建立连接,我配置了/etc/freetds/freetds.conf、/etc/odbc.ini和/etc/odbcinst.ini:

freetds.conf:

代码语言:javascript
复制
 A typical Microsoft server
 [wsus]
  host = my-ip-sql-server
  port = 1433
  tds version = 4.2

odbc.ini

代码语言:javascript
复制
[wsus]
  Driver = FreeTDS
  Trace = No
  ServerName = wsus
  Database= Asegurador

作为

odbcinst.ini

代码语言:javascript
复制
[wsus]
  Description = tdsodbc
  Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
  Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
  FileUsage = 1
  CPTimeout = 5

命令输出= tsql -C:

代码语言:javascript
复制
Compile-time settings (established with the "configure" script)
                            Version: freetds v0.91
             freetds.conf directory: /etc/freetds
     MS db-lib source compatibility: no
        Sybase binary compatibility: yes
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 4.2
                              iODBC: no
                           unixodbc: yes
              SSPI "trusted" logins: no
                           Kerberos: yes

当我运行一个tsql时,连接是成功的:

代码语言:javascript
复制
$ tsql -S  wsus -U username -P password
locale is "es_ES.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1> select top 1 FechaFactura, Vendedor, ClaseDoc  from [Aseguradoras].[dbo].[mknDetalleAseguradoras]
2> go
FechaFactura    Vendedor    ClaseDoc
2014-07-12         xx           2

但当我运行isql时:

$ isql -v wsus用户名密码IM002Driver ManagerData源名未找到,也没有默认驱动程序指定ISQLERROR:无法SQLConnect

提前谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-05-25 15:16:55

在odbcinst.ini中,您需要提供驱动程序名称,而不是DSN。更改:

代码语言:javascript
复制
[wsus]

至:

代码语言:javascript
复制
[FreeTDS]

您还应该修改TDS版本,最有可能修改为7.3 ( Server 2008-2014年),如前所述。

那就该这么做了!祝好运。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30127894

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档