Build Status CRAN_Status_Badge CRAN_Status_Badge

DatabaseConnector is part of HADES.


This R package provides function for connecting to various DBMSs. Together with the SqlRender package, the main goal of DatabaseConnector is to provide a uniform interface across database platforms: the same code should run and produce equivalent results, regardless of the database back end.



connectionDetails <- createConnectionDetails(dbms="postgresql", 
conn <- connect(connectionDetails)
querySql(conn,"SELECT COUNT(*) FROM person")


DatabaseConnector is an R package using Java's JDBC drivers.

System Requirements

Running the package requires R with the package rJava installed. Also requires Java 1.8 or higher.


  1. See the instructions here for configuring your R environment, including Java.

  2. To install the latest stable version, install from CRAN:


To download and use the JDBC drivers for Oracle, SQL Server, PDW, PostgreSQL, or RedShift, you can use the downloadJdbcDrivers() function. For BigQuery, Impala, or Netezza, see these instructions.

To be able to use Windows authentication for SQL Server, you have to install the JDBC driver. Download the .zip from Microsoft and extract its contents to a folder. In the extracted folder you will find the file sqljdbc_9.2/enu/auth/x64/mssql-jdbc_auth-9.2.0.x64.dll (64-bits) or ssqljdbc_9.2/enu/auth/x86/mssql-jdbc_auth-9.2.0.x86.dll (32-bits), which needs to be moved to location on the system path, for example to c:/windows/system32. If you not have write access to any folder in the system path, you can also specify the path to the folder containing the dll by setting the environmental variable PATH_TO_AUTH_DLL, so for example Sys.setenv("PATH_TO_AUTH_DLL" = "c:/temp").

User Documentation

Documentation can be found on the package website.

PDF versions of the documentation are also available: Vignette: Using DatabaseConnector Package manual: DatabaseConnector manual



Read here how you can contribute to this package.


DatabaseConnector is licensed under Apache License 2.0. The JDBC drivers fall under their own respective licenses.


DatabaseConnector is being developed in R Studio.

Development status

Stable. The code is actively being used in several projects.


Try the DatabaseConnector package in your browser

Any scripts or data that you put into this service are public.

DatabaseConnector documentation built on April 15, 2021, 9:06 a.m.