Connecting to Partners Microsoft SQL server from Partners Rstudio (rstudio.partners.org)

Purpose:

  • Instructions to connect to Partners MS SQL servers from Partners Rstudio (rstudio.partners.org)

 

Requirements:

  • You have to have access ready for the SQL server that you want to connect to.
  • You need to know the database server name. You do not have to set the database name.

 

Instructions

 

       In this example, we are trying to connect to phssql826.partners.org as user hp911

 

  1. Open any text editor and paste the following

 

[phsedw]

Driver = FreeTDS

Server = phsedw.partners.org

Port = 1433

TDS_Version = 8.0

 

  1. Save as “.odbc.ini”. Do not forget the leading dot.

 

  1. Open Partners Rstudio and upload this file to your home directory.

 

  1. Quit the current session and start new session

 

  1. Let’s test in R console (rstudio.partners.org)

 

>library(RODBC)

>odbc <- odbcConnect("phsedw", "Partners\\hp911", .rs.api.askForPassword("password"))

>dat <- sqlQuery(odbc, "## your query here ##")

 


Related articles