通过 R DBI 程序包连接到 MS SQL 服务器时出现问题
Problems Connecting to MS SQL Server Through R DBI Package
我正在尝试使用 Mac 建立到 SQL 服务器的连接
Microsoft OBDC 驱动程序和 DBI 包。
连接建立,但是字符字段,甚至那些没有特殊字符的字段,return 出现乱码。该数据库是专有的,所以我对我可以显示的实际输出有限制。数字字段 return 没问题。
一些其他笔记。
- 如果我提交查询,我可以使用正确的 table 接收记录集。比如下面查询returns的结果,列名是正确的。列数据乱码
> dbGetquery(con, "Select name from tb1", n = 1)
Warning: Pending rows
name
1 CalteMtrSeda
dbListTables()
也是 return 的乱码输出,尽管如上所示,我可以从按名称引用它的 table 接收输出。
dbListTables()
return正确的table个数,但是名字看不懂
grep("tb1", dbListTables(con), value = TRUE)
character(0)
- 我的
con
对象的输出
> con
<OdbcConnection> user@ExpectedDataBase
Database: NameIWouldExpect
Microsoft SQL Server Version: 13.00.1742
** 已更新以包含模式。
我得到了所有其他角色 returned。从上面的例子。
CalteMtrSeda == CharlotteMotorSpeedway
这是我第一次尝试从 Mac 连接到此数据库。
原来和R3.6有关。恢复到 R3.5 解决了这个问题。 Link 到 odbc
repo
中的相关问题
我正在尝试使用 Mac 建立到 SQL 服务器的连接 Microsoft OBDC 驱动程序和 DBI 包。
连接建立,但是字符字段,甚至那些没有特殊字符的字段,return 出现乱码。该数据库是专有的,所以我对我可以显示的实际输出有限制。数字字段 return 没问题。
一些其他笔记。
- 如果我提交查询,我可以使用正确的 table 接收记录集。比如下面查询returns的结果,列名是正确的。列数据乱码
> dbGetquery(con, "Select name from tb1", n = 1)
Warning: Pending rows
name
1 CalteMtrSeda
dbListTables()
也是 return 的乱码输出,尽管如上所示,我可以从按名称引用它的 table 接收输出。dbListTables()
return正确的table个数,但是名字看不懂
grep("tb1", dbListTables(con), value = TRUE)
character(0)
- 我的
con
对象的输出
> con
<OdbcConnection> user@ExpectedDataBase
Database: NameIWouldExpect
Microsoft SQL Server Version: 13.00.1742
** 已更新以包含模式。
我得到了所有其他角色 returned。从上面的例子。
CalteMtrSeda == CharlotteMotorSpeedway
这是我第一次尝试从 Mac 连接到此数据库。
原来和R3.6有关。恢复到 R3.5 解决了这个问题。 Link 到 odbc
repo