Load and unload database drivers.

dbDriver is a helper method used to create an new driver object given the name of a database or the corresponding R package. It works through convention: all DBI-extending packages should provide an exported object with the same name as the package. dbDriver just looks for this object in the right places: if you know what database you are connecting to, you should call the function directly.

dbDriver(drvName, ...)
dbUnloadDriver(drv, ...)
character name of the driver to instantiate.
any other arguments are passed to the driver drvName.
an object that inherits from DBIDriver as created by dbDriver.

In the case of dbDriver, an driver object whose class extends DBIDriver. This object may be used to create connections to the actual DBMS engine.In the case of dbUnloadDriver, a logical indicating whether the operation succeeded or not.

Side Effects

The client part of the database communication is initialized (typically dynamically loading C code, etc.) but note that connecting to the database engine itself needs to be done through calls to dbConnect.

  • dbDriver
  • dbDriver,character-method
  • dbUnloadDriver
if (require("RSQLite")) {
# Create a RSQLite driver with a string
d <- dbDriver("SQLite")

# But better, access the object directly
Documentation reproduced from package DBI, version 0.4-1, License: LGPL (>= 2)

Community examples

lorna1661maria@gmail.com at Aug 15, 2018 DBI v0.5-1

``` Library( RPostrgeSQL) # Create a RPostrgesql Driver as pg pg = dbDriver("PostgreSQL") #Pass the database driver as pg in the connection function con = dbConnect(pg, user="Kalm", password="", host="localhost", port=5000, dbname="test_db") ```