Open or close a connection to the local ECOTOX database
Source:R/database_access.r
dbConnectEcotox.Rd
Wrappers for dbConnect()
and
dbDisconnect()
methods.
Usage
dbConnectEcotox(path = get_ecotox_path(), version, ...)
dbDisconnectEcotox(conn, ...)
Arguments
- path
A
character
string with the path to the location of the local database (default isget_ecotox_path()
).- version
A
character
string referring to the release version of the database you wish to locate. It should have the same format as the date in the EPA download link, which is month, day, year, separated by underscores ("%m_%d_%Y"). When missing, the most recent available copy is selected automatically.- ...
Arguments that are passed to
dbConnect()
method ordbDisconnect()
method.- conn
An open connection to the ECOTOX database that needs to be closed.
Value
A database connection in the form of a DBI::DBIConnection-class()
object.
The object is tagged with: a time stamp; the package version used; and the
file path of the SQLite database used in the connection. These tags are added as attributes
to the object.
Details
Open or close a connection to the local ECOTOX database. These functions are only required when you want
to send custom queries to the database. For most searches the search_ecotox()
function
will be adequate.
Examples
if (FALSE) { # \dontrun{
## This will only work when a copy of the database exists:
con <- dbConnectEcotox()
## check if the connection works by listing the tables in the database:
dbListTables(con)
## Let's be a good boy/girl and close the connection to the database when we're done:
dbDisconnectEcotox(con)
} # }