从R连接到SQL数据库时截断数据库名称和列 [英] Truncation of database name and columns while connecting to SQL database from R

查看:98
本文介绍了从R连接到SQL数据库时截断数据库名称和列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行R 3.5.0的macOS Catalina(版本10.15.1)上.我正在Docker本地运行SQL Server.为了连接到服务器,我正在使用odbc:

I am on macOS Catalina (Version 10.15.1), running R 3.5.0. I am running SQL server on Docker locally. For connecting to the server, I am using odbc:

con <- dbConnect(odbc(), 
                   Driver = "Simba SQL Server ODBC Driver", 
                   Server = "localhost", 
                   UID = 'SA',
                   PWD  = 'XXXXXXXX',
                   database = dbname)

我能够连接到服务器,但是其中所有数据库的名称都被截断为仅第一个字母,如下所示:

I am able to connect to the server, however the names of all the databases therein are getting truncated to just the first letter as shown here:

随后,所有字符列也仅显示第一个字母.

Subsequently all the character columns are also showing only the first letter.

我查看了,但无法弄清楚为什么会这样.对于初学者来说,数据库本身的名称(如"RStudio连接"窗格中所示)已被截断.

I had a look at this, but just can't figure out why this is happening. For starters, the names of the databases itself, as shown in the RStudio Connections pane, are getting truncated.

我能够使用Azure Data Studio连接到数据库并正确查看所有列.

I am able to connect to the databases using Azure Data Studio and see all the columns correctly.

推荐答案

我看了

I had a look at this and turns out this was exactly what I was facing. Followed the steps mentioned here to resolve the issue.

这篇关于从R连接到SQL数据库时截断数据库名称和列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆