2017-08-02 49 views
0

在我嘗試編譯啓用msdblib的freeTDS之前,我想確保這是我需要做的。或者我的問題在別處?我在配置中看過很多帖子,但沒有提到msdblib。是否必須將「MS db-lib源兼容性」設置爲「yes」才能使用freetds連接到mssql?

$tsql -S mssql -U user -P pass 
locale is "en_US.UTF-8" 
locale charset is "UTF-8" 
using default charset "UTF-8" 
Error 20009 (severity 9): 
    Unable to connect: Adaptive Server is unavailable or does not exist 
    OS error 61, "Connection refused" 
There was a problem connecting to the server 

$odbcinst -j 
unixODBC 2.3.4 
DRIVERS............: /usr/local/Cellar/unixodbc/2.3.4/etc/odbcinst.ini 
SYSTEM DATA SOURCES: /usr/local/Cellar/unixodbc/2.3.4/etc/odbc.ini 
FILE DATA SOURCES..: /usr/local/Cellar/unixodbc/2.3.4/etc/ODBCDataSources 
USER DATA SOURCES..: /Users/administrator/.odbc.ini 
SQLULEN Size.......: 8 
SQLLEN Size........: 8 
SQLSETPOSIROW Size.: 8 

$tsql -C 
    Compile-time settings (established with the "configure" script) 
          Version: freetds v1.00.48 
      freetds.conf directory: /usr/local/Cellar/freetds/1.00.48/etc 
    MS db-lib source compatibility: no 
     Sybase binary compatibility: no 
         Thread safety: yes 
         iconv library: yes 
         TDS version: 7.3 
           iODBC: no 
          unixodbc: yes 
       SSPI "trusted" logins: no 
          Kerberos: no 
          OpenSSL: yes 
          GnuTLS: no 
           MARS: no 

freetds.conf

[global] 
     # TDS protocol version 
     tds version = 7.3 

...

# A typical Microsoft server 
[mssql] 
     host = 10.x.x.x 
     port = 1433 
     tds version = 7.3 

ODBC.INI

[mssql] 
Description   = Test to SQLServer 
Driver    = FreeTDS 
Servername   = mssql 

ODBCINST.INI

[FreeTDS] 
Description=FreeTDS Driver for Linux & MSSQL 
Driver=/usr/local/lib/libtdsodbc.so 
Setup=/usr/local/lib/libtdsodbc.so 
UsageCount=1 
+0

重新安裝freetds brew安裝freetds --with-msdblib 沒有幫助:( – Openmic

回答

0

我不知道是否需要MS SQL訪問freetds的的--with-msdblib選項,但我可以使用主機名和實例進行連接。但首先我必須找出實例名稱,可以通過tsql -LH xxx.xx.xxx.xxx完成。出於某種原因,我無法連接主機名和端口,我不得不使用主機名和實例。總是閱讀文檔,你們都!只花了我5個小時。

相關問題