我正在尝试从Mac连接到SQL Server数据库。以下是我配置驱动程序的方法:
--- /etc/freetds/freetds.conf ---
[TS]
host = MISSDBServer01.xxxxxxxx.com
port = 1433
tds version = 7.0
client charset = UTF-8
--- /etc/odbcinst.ini ---
[FreeTDS]
Description = FreeTDS
Driver = /usr/local/lib/libtdsodbc.so
--- /etc/odbc.ini ---
[TS]
Driver = FreeTDS
Server = db.ip.add.ress
ServerName = xxxxAB288
Port = 1433
TDS_Version = 7.0
当我尝试通过tsql
连接时,一切都很好:
tsql -S TS -U user -P pass
locale is "en_GB.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1> select @@version
2> go
Microsoft SQL Server 2012 (SP3) (KB3072779) - 11.0.6020.0 (X64)
Oct 20 2015 15:36:27
Copyright (c) Microsoft Corporation
Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.2 <X64> (Build 9200: ) (Hypervisor)
(1 row affected)
1> exit
但是当我尝试使用isql
进行连接时,我收到此错误:
isql -v TS user pass
[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect
我遵循列出here和here的建议,并且我的最终目标是通过R连接到MS SQL Server,还尝试了来自here和here的解决方案。
更新
根据@Jim的建议,我运行了odbcinst -j
来获取配置文件目录:
unixODBC 2.3.4
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /Users/USERNAME/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
但是当我去/etc
文件夹时,我无法在那里找到它们。为什么?
当我运行odbcinst -q -d
时,我得到odbcinst: SQLGetPrivateProfileString failed with Unable to find component name.
。我尝试按照建议here创建和修改.bash_profile
文件来修复它,但它没有任何区别。
当我运行odbcinst -q -s
时,我得到了odbcinst: SQLGetPrivateProfileString failed with .
,但此时我真的不知道该怎么办......
我会感谢任何有关如何使其发挥作用的建议!谢谢!