Duncan Ellis
Duncan Ellis

Reputation: 346

Problems Connecting to MS SQL Server Through R DBI Package

I'm trying to setup a connection to a SQL Server from my Mac using the Microsoft OBDC Driver and the DBI package.

The connection establishes, however character fields, even those that have no special characters, return garbled. The database is proprietary so I'm limited as to what actual output I can show. Numeric fields return fine.

Some other notes.

> dbGetquery(con, "Select name from tb1", n = 1)
Warning: Pending rows
              name
1     CalteMtrSeda

grep("tb1", dbListTables(con), value = TRUE)
character(0)
> con
<OdbcConnection> user@ExpectedDataBase
  Database: NameIWouldExpect
  Microsoft SQL Server Version: 13.00.1742

** Updated to include pattern.

I'm getting every other character returned. From the example above. CalteMtrSeda == CharlotteMotorSpeedway

This is the first time I've attempted to connect to this database from a Mac.

Upvotes: 1

Views: 243

Answers (1)

Duncan Ellis
Duncan Ellis

Reputation: 346

Turned out to be related to R3.6. Reverting to R3.5 fixed the issue. Link to relevant issue in odbc repo

https://github.com/r-dbi/odbc/issues/283

Upvotes: 1

Related Questions