3

Does anyone have a link for a good walkthrough on connecting to Microsoft SQL Server using R on a Mac? I've been looking for awhile and can't seem to find anything that works for me.

Brad Cannell
  • 3,020
  • 2
  • 23
  • 39
  • There is nothing mac-specific when establishing a connection. I run a MS-SQL server using VMware on my Mac and connect to it from R the same way as to any other instance of MS-SQL server running on a remote server. You can either use `RODBC` or `RJDBC` package to connect. This [link](http://brazenly.blogspot.co.at/2014/05/r-how-to-connect-r-to-database-sql.html) might help. – hvollmeier Jan 26 '17 at 08:26
  • Have you solved this problem? I'm faced with the same issue – Taraas May 02 '18 at 14:45
  • @Taraas Unfortunately, I did not. I ended up using a PC at work to pull the data down. – Brad Cannell May 02 '18 at 16:36
  • OK I solved this. Posting separately. – Taraas May 15 '18 at 14:59

3 Answers3

1

I got it to work for me.

I had to use SQL Server driver from Simba (not the Microsoft's one) and set this parameter: Integrated Security=NTLM (I think same could have been done for Trusted Connection)

https://community.rstudio.com/t/rstudio-database-connections-using-windows-authentication/7465/32

Taraas
  • 1,268
  • 1
  • 11
  • 20
-1

Maybe you will find what you are looking for at the URL below.

http://www.odbcmanager.net/about.php

I have never used MAC. I don't know anything about that kind of machine.

ASH
  • 20,759
  • 19
  • 87
  • 200
-3

I have never used a Mac machine in my life, but for R and SQL, I don't think it make any difference what kind of machine you are on. The following works for me.

library(RODBC)
dbconnection <- odbcDriverConnect("Driver=ODBC Driver 11 for SQL Server;Server=Server_Name\\SQLEXPRESS; Database=TestDB;Uid=; Pwd=; trusted_connection=yes")
initdata <- sqlQuery(dbconnection,paste("select * from MyTable;"))
odbcClose(channel)

RODBC odbcDriverConnect() Connection Error

https://andersspur.wordpress.com/2013/11/26/connect-r-to-sql-server-2012-and-14/

Give it a try on your side.

Community
  • 1
  • 1
ASH
  • 20,759
  • 19
  • 87
  • 200
  • 1
    Thanks. I think the problem I'm having is finding the correct driver to setup the ODBC connection. The Windows OS has a built-in driver. Mac OS does not. – Brad Cannell Feb 01 '17 at 16:08