ODBC isql
無法連接到數據源:ODBC無法連接到MSSQL數據源在OS X獅子
$ isql SMS_GTWY username password -v
回報:
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[01000][unixODBC][FreeTDS][SQL Server]Unknown host machine name.
[ISQL]ERROR: Could not SQLConnect
而tsql
是確定:
$ tsql -S SERVER001 -U username -P password
回報:
locale is "C/UTF-8/C/C/C/C"
locale charset is "UTF-8"
using default charset "UTF8"
1>
$ cat ~/.freetds.conf
:
[SERVER001]
host = 192.168.8.101
port = 1433
tds version = 8.0
client charset = UTF8
$ cat ~/.odbc.ini
:
[SMS_GTWY]
Description = SERVER001 Server
Driver = freetds
Database = SMS_GTWY
ServerName = SERVER001
TDS_Version = 7.1
$ cat ~/.odbcinst.ini
:
[freetds]
Description = MS SQL database access with FreeTDS
Driver = /usr/local/lib/libtdsodbc.so
Setup = /usr/local/lib/libtdsodbc.so
UsageCount = 1
freetds
和unixODBC
是由家庭安裝0。
我在CentOS上有類似的設置,odbc isql到mssqlserver工作正常。有一個noticable區別,我看不出在OS X
# cat /etc/odbcinst.ini
在CentOS一個libtdsS.so
安裝:
[freetds]
Description = MS SQL database access with FreeTDS
Driver = /usr/lib/libtdsodbc.so
Setup = /usr/lib/libtdsS.so
UsageCount = 1
是這樣的問題的原因是什麼?
p.s. $ odbcinst -j
回報:
unixODBC 2.3.1
DRIVERS............: /usr/local/Cellar/unixodbc/2.3.1/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/Cellar/unixodbc/2.3.1/etc/odbc.ini
FILE DATA SOURCES..: /usr/local/Cellar/unixodbc/2.3.1/etc/ODBCDataSources
USER DATA SOURCES..: /Users/horace/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
$ odbcinst -q -d
回報:
[freetds]
$ odbcinst -q -s
回報:
[SMS_GTWY]
你是個天才!這試圖遵循這些其他有用的說明,保存了我的培根。 - http://www.acloudtree.com/how-to-install-freetds-and-unixodbc-on-osx-using-homebrew-for-use-with-ruby-php-and-perl/ –
謝謝。我也有這個問題。重新安裝 – Greg