如何在Linux Ubuntu上配置freetds和unixodbc

时间:2015-05-08 15:48:03

标签: linux ubuntu freetds unixodbc

我尝试在Linux上创建与Linux上的freetds + unixodbc连接到数据库的连接,我配置了/etc/freetds/freetds.conf,/​​etc/odbc.ini和/etc/odbcinst.ini:< / p>

freetds.conf:

[wsus]
  Driver = FreeTDS
  Trace = No
  ServerName = wsus
  Database= Asegurador

ODBC.INI

[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

作为

ODBCINST.INI

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 -C:

$ 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

当我运行tsql时,连接成功:

{{1}}

但是当我运行isql时:

  

$ isql -v wsus username密码[IM002] [unixODBC] [Driver Manager]数据   找不到源名称,并且未指定默认驱动程序[ISQL]错误:   无法SQLConnect

提前致谢。

1 个答案:

答案 0 :(得分:1)

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

[wsus]

为:

[FreeTDS]

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

应该这样做!祝你好运。