使用isql将Mac Sierra连接到SQL Server

时间:2017-11-02 09:14:44

标签: sql-server r macos odbc

我正在尝试从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

我遵循列出herehere的建议,并且我的最终目标是通过R连接到MS SQL Server,还尝试了来自herehere的解决方案。

更新

  1. 根据@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文件夹时,我无法在那里找到它们。为什么?

  2. 当我运行odbcinst -q -d时,我得到odbcinst: SQLGetPrivateProfileString failed with Unable to find component name.。我尝试按照建议here创建和修改.bash_profile文件来修复它,但它没有任何区别。

  3. 当我运行odbcinst -q -s时,我得到了odbcinst: SQLGetPrivateProfileString failed with .,但此时我真的不知道该怎么办......

  4. 我会感谢任何有关如何使其发挥作用的建议!谢谢!

0 个答案:

没有答案