Skip to content

Using RStudio Professional Drivers#

RStudio is now Posit!

Our professional products have been renamed to Posit Connect, Posit Workbench, Posit Package Manager, Posit Cloud, and Posit Academy so it’s easier for folks to understand that we support more than just R. Please review our Blog post/FAQ to answer commonly asked questions about the rebrand.

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 RStudio (the 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 our Solutions site for best practices, examples, and additional configurations to use when working with databases and the Posit Professional Drivers.

Troubleshooting#

Refer to Troubleshooting Posit Professional Drivers for additional information on troubleshooting the Connections pane in RStudio (the IDE).