在尝试使用msdblib编译freeTDS之前,我想确保这就是我需要做的事情。或者我的问题在别的地方?我在配置上看过很多帖子,但没有提到msdblib。
$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 :(得分:0)
我不确定MS SQL访问是否需要freetds的--with-msdblib
选项,但我能够使用主机名和实例进行连接。但首先我必须找出实例名称,这可以通过tsql -LH xxx.xx.xxx.xxx
来完成。由于某种原因,我无法连接主机名和端口,我不得不使用主机名和实例。总是阅读文档,你们都!我只花了5个小时。