dbConnectEcotox: Open or close a connection to the local ECOTOX database

View source: R/database_access.r

dbConnectEcotoxR Documentation

Open or close a connection to the local ECOTOX database

Description

[Stable] 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 is get_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 or dbDisconnect() method.

conn

An open connection to the ECOTOX database that needs to be closed.

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.

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.

Author(s)

Pepijn de Vries

Examples

## Not run: 
## 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)

## End(Not run)

ECOTOXr documentation built on Sept. 20, 2024, 5:06 p.m.