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.
DBI interface.dbplyr interface.
connectionDetails <- createConnectionDetails(dbms="postgresql",
server="localhost",
user="root",
password="blah")
conn <- connect(connectionDetails)
querySql(conn,"SELECT COUNT(*) FROM person")
disconnect(conn)Running the package requires R with the package rJava installed. Most of the JDBC drivers will run on Java >= 8. However, some drivers (e.g. Spark / DataBricks) will require a higher Java version. We recommend running Java 21, which is the version used in our continuous integration.
See the instructions here for configuring your R environment, including Java.
To install the latest stable version, install from CRAN:
install.packages("DatabaseConnector")Documentation can be found on the package website.
PDF versions of the documentation are also available:
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.