gpt4 book ai didi

sql-server - odbc 无法连接到 OS X Lion 上的 MSSQL 数据源

转载 作者:行者123 更新时间:2023-12-03 17:01:52 24 4
gpt4 key购买 nike

odbc isql无法连接到数据源:

 $ 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
freetdsunixODBC在家安装 brew .

我在 CentOS 上有类似的设置,odbc isql 到 mssqlserver 工作正常。有一个明显的区别,我没有看到 libtdsS.so安装在 OS X 上。
# cat /etc/odbcinst.ini在 CentOS 上:
 [freetds]
Description = MS SQL database access with FreeTDS
Driver = /usr/lib/libtdsodbc.so
Setup = /usr/lib/libtdsS.so
UsageCount = 1

这是问题的原因吗?

附言 $ 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]

最佳答案

isql重新安装后工作unixodbcfreetds ( --with-unixodbc ):

 brew uninstall freetds
brew uninstall unixodbc

brew install unixodbc
brew install freetds --with-unixodbc

现在, $ isql -v SMS_GTWY username password返回:
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>

信用: https://gist.github.com/565440

关于sql-server - odbc 无法连接到 OS X Lion 上的 MSSQL 数据源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13872340/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com