我已经使用 Homebrew 安装了 freetds。我的配置如下:
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/mark.richman/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
/usr/local/Cellar/unixodbc/2.3.1/etc/odbcinst.ini:
[ODBC]
Trace = Yes
TraceFile = /tmp/odbc.log
/usr/local/Cellar/freetds/0.91/etc/freetds.conf:
[db.mydomain.local]
host = db.mydomain.local
port = 1433
tds version = 8.0
client charset = UTF-8
~/.odbc.ini:
[MomImporterDSN]
Description = Mom Importer
Driver = /usr/local/Cellar/freetds/0.91/lib/libtdsodbc.so
Servername = db.mydomain.local
Database = MomImporter
UserName = mark.richman
Password = mypassword
当我尝试时isql -v MomImporterDSN
,出现以下错误:
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[01000][unixODBC][FreeTDS][SQL Server]Adaptive Server connection failed
[ISQL]ERROR: Could not SQLConnect
我的/tmp/odbc.log
似乎不是特别有用:
[ODBC][14514][1373290079.248688][__handles.c][460]
Exit:[SQL_SUCCESS]
Environment = 0x7fcbe1004c00
[ODBC][14514][1373290079.249314][SQLAllocHandle.c][375]
Entry:
Handle Type = 2
Input Handle = 0x7fcbe1004c00
[ODBC][14514][1373290079.249470][SQLAllocHandle.c][493]
Exit:[SQL_SUCCESS]
Output Handle = 0x7fcbe1024800
[ODBC][14514][1373290079.249712][SQLConnect.c][3700]
Entry:
Connection = 0x7fcbe1024800
Server Name = [MOMImporterDSN][length = 14 (SQL_NTS)]
User Name = [NULL]
Authentication = [NULL]
UNICODE Using encoding ASCII 'char' and UNICODE 'UCS-2-INTERNAL'
DIAG [01000] [FreeTDS][SQL Server]Adaptive Server connection failed
DIAG [S1000] [FreeTDS][SQL Server]Unable to connect to data source
[ODBC][14514][1373290079.703504][SQLConnect.c][4067]
Exit:[SQL_ERROR]
[ODBC][14514][1373290079.704257][SQLError.c][434]
Entry:
Connection = 0x7fcbe1024800
SQLState = 0x7fff5a823526
Native = 0x7fff5a823520
Message Text = 0x7fff5a823530
Buffer Length = 500
Text Len Ptr = 0x7fff5a82351e
[ODBC][14514][1373290079.704559][SQLError.c][471]
Exit:[SQL_SUCCESS]
SQLState = S1000
Native = 0x7fff5a823520 -> 0
Message Text = [[unixODBC][FreeTDS][SQL Server]Unable to connect to data source]
[ODBC][14514][1373290079.704777][SQLError.c][434]
Entry:
Connection = 0x7fcbe1024800
SQLState = 0x7fff5a823526
Native = 0x7fff5a823520
Message Text = 0x7fff5a823530
Buffer Length = 500
Text Len Ptr = 0x7fff5a82351e
[ODBC][14514][1373290079.704996][SQLError.c][471]
Exit:[SQL_SUCCESS]
SQLState = 01000
Native = 0x7fff5a823520 -> 20002
Message Text = [[unixODBC][FreeTDS][SQL Server]Adaptive Server connection failed]
[ODBC][14514][1373290079.705172][SQLError.c][434]
Entry:
Connection = 0x7fcbe1024800
SQLState = 0x7fff5a823526
Native = 0x7fff5a823520
Message Text = 0x7fff5a823530
Buffer Length = 500
Text Len Ptr = 0x7fff5a82351e
[ODBC][14514][1373290079.705357][SQLError.c][471]
Exit:[SQL_NO_DATA]
[ODBC][14514][1373290079.705583][SQLError.c][514]
Entry:
Environment = 0x7fcbe1004c00
SQLState = 0x7fff5a823526
Native = 0x7fff5a823520
Message Text = 0x7fff5a823530
Buffer Length = 500
Text Len Ptr = 0x7fff5a82351e
[ODBC][14514][1373290079.705763][SQLError.c][551]
Exit:[SQL_NO_DATA]
[ODBC][14514][1373290079.706061][SQLFreeHandle.c][284]
Entry:
Handle Type = 2
Input Handle = 0x7fcbe1024800
[ODBC][14514][1373290079.706195][SQLFreeHandle.c][333]
Exit:[SQL_SUCCESS]
[ODBC][14514][1373290079.706415][SQLFreeHandle.c][219]
Entry:
Handle Type = 1
Input Handle = 0x7fcbe1004c00
我正在使用 Mountain Lion 10.8.4、unixodbc 2.3.1、freetds 0.91 和 SQL Server 2008。
谢谢!