Skip to content

Using RStudio Professional Drivers#

Install odbc package#

You will use the odbc R package to access your database with R. Installing odbc will also install DBI, the database interface for R.

From an R prompt, install the odbc package:

R Console

> install.packages("odbc")
Dependencies

On Linux, the odbc R package requires the following system dependencies in Linux:

  • C++11
  • GCC 4.8 or later

On older versions of RHEL, you can install GCC 4.8 with RedHat Developer Toolset:

$ sudo yum install devtoolset-4-gcc-c++

Test connectivity#

Test your connection in R with odbc::odbc(). If you are using the RStudio IDE, you can use the New Connection dialog to help you write the connection string, for example:

R Console

> con <- DBI::dbConnect(odbc::odbc(),
         Driver = "Driver Name",
         Database = "Database",
         UID = "User",
         PWD = "Password",
         Server = "Server",
         Port = 5432)

Visit db.rstudio.com for best practices, examples, and additional configurations to use when working with databases and the RStudio Professional Drivers.

Troubleshooting#

Refer to the support article on Troubleshooting Connections for additional information on troubleshooting the Connections pane in the RStudio IDE.