dbDriver: Load and unload database drivers.
Description
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.Usage
dbDriver(drvName, ...)dbUnloadDriver(drv, ...)
Arguments
drvName
character name of the driver to instantiate.
...
any other arguments are passed to the driver drvName
.
drv
an object that inherits from DBIDriver
as created by
dbDriver
.
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
.Examples
Run this codeif (require("RSQLite")) {
# Create a RSQLite driver with a string
d <- dbDriver("SQLite")
d
# But better, access the object directly
RSQLite::SQLite()
}
Run the code above in your browser using DataLab