首页 文章

如何在Linux Ubuntu上配置freetds和unixodbc

提问于
浏览
2

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

freetds.conf:

A typical Microsoft server
 [wsus]
  host = my-ip-sql-server
  port = 1433
  tds version = 4.2

ODBC.INI

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

ODBCINST.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

命令输出= tsql -C:

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时,连接成功:

$ 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 username密码[IM002] [unixODBC] [驱动程序管理器]未找到数据源名称,并且未指定默认驱动程序[ISQL]错误:无法SQLConnect

提前致谢 .

1 回答

  • 1

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

    [wsus]
    

    至:

    [FreeTDS]
    

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

    应该这样做!祝好运 .

相关问题