首页 > 解决方案 > Truncation of database name and columns while connecting to SQL database from R

问题描述

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:

enter image description here

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

enter image description here

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.

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

标签: rodbc

解决方案


我看了看,结果发现正是我所面临的。按照此处提到的步骤解决问题。


推荐阅读