我使用RODBC和unixodbc在OSX Yosemite上使RODBC连接到SQL Server 2012已经工作了几个小时。我在R中收到的错误非常通用:
> odbcDriverConnect("DSN=ISTSQL;UID=sa;PWD=***")
[1] -1
Warning messages:
1: In odbcDriverConnect("DSN=ISTSQL;UID=sa;PWD=***") : [RODBC] ERROR: state ±6S, code 20013, message
2: In odbcDriverConnect("DSN=ISTSQL;UID=sa;PWD=***") : [RODBC] ERROR: state ±6S, code 0, message
3: In odbcDriverConnect("DSN=ISTSQL;UID=sa;PWD=***") :
ODBC connection failed
Warning messages:
1: In strsplit(msgs[i], "\n") : input string 1 is invalid in this locale
2: In strsplit(msgs[i], "\n") : input string 1 is invalid in this locale
我的/etc/freetds.conf
文件包含以下内容:
[ISTSQL]
host = ip.address
port = 1433
tds version = 8.0
我的/etc/odbcinst.ini
文件如下:
[MSSQL]
Description = Microsoft SQL Server driver
Driver = /usr/local/Cellar/freetds/0.95.8/lib/libtdsodbc.so
UsageCount = 1
我的/etc/odbc.ini
文件如下:
[ISTSQL]
Driver = MSSQL
Servername = ISTSQL
Port = 1433
Database = TMS
TDS_Version = 8.0
我可以通过tsql
命令和isql
命令从命令行连接到数据库。有没有人知道如何解决这个问题或找到更详细的错误日志?
答案 0 :(得分:2)
要获得更好的错误消息,请在?warning
:
Warnings will be truncated to 'getOption("warning.length")'
characters, default 1000, indicated by '[... truncated]'.
这可能会帮助您获得更好的调试信息。