1

I'm trying to get started with R services on SQL Server 2016. I was following this example from MS on youtube.

2 min 22sec into the vid John shows a reference to library(RODBC)... which I don't have. So I have downloaded the RODBC driver from CRAN

According to the documentation:

RODBC is simple to install, and binary distributions are available for Windows from CRAN

But it provides no further details about how to install it. It mentions an ODBC Driver Manager but not much more than that.

So.. How do I install RODBC?

Do I unzip it to a specific path? Is there a utility or tool required to install it? Do I run a script?

2

To install R packages in SQLServer 2016, you first have to launch R GUI (somewhere like D:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\R_SERVICES\bin\x64\Rgui.exe).

If your server is connected to the web, you can launch a :

install.packages("RODBC")

Otherwise, download the package (see https://cran.r-project.org/web/packages/RODBC/index.html), put it your server, for instance in a folder D:\R_Packages, and launch the R command :

setwd("D:/R_Packages")
install.packages("RODBC_1.3-14.zip", repos=NULL)

This second method is not very convenient in case of package dependencies : you'll have to download / install manually all the packages needed....

Anyway, in you want RODBC to access SQLServer databases, maybe you don't need it. Have a look at sp_execute_external_script procedure which help you to connect directly R and SQLServer.

2
  • Thanks for your reply. I tried your suggestions but am now getting errors about paths. My default directory is mapped to a network drive. Once I figure that out I'll come back to this. Cheers. Oct 12 '16 at 20:05
  • @Peter : what kind of error do you have ?
    – irimias
    Oct 26 '16 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.