aqrcDBconnect: Function to connect to the AQRC databases

View source: R/aqrcDBconnect.R

aqrcDBconnectR Documentation

Function to connect to the AQRC databases

Description

This function will connect to the AQRC databases (IMPROVE or CSN). The database connection is through a pool object. See the documentation for the pool package for details.

Usage

aqrcDBconnect(network = c("IMPROVE", "CSN"), server)

Arguments

network

Character string of the network to connect to (IMPROVE or CSN).

server

Character string of the server to connect to. Typically something like "aqrc-sql", "aqrc-sql-test", and "aqrc-sql-appdev" (default is the production database server "aqrc-sql").

Details

This function will open a database connection via the pool package. Because this is opening pool connections to the database, it is best practice to ensure these connections are closed after database operations are finished. For details of the pool package see its website at https://github.com/rstudio/pool.

Value

A pool connection to the database defined by the parameters.

See Also

dbPool

Examples

## Not run: 
poolIMP <- aqrcDBconnect("IMPROVE", "aqrc-sql-test")
poolCSN <- aqrcDBconnect("CSN", "aqrc-test")
# Perform some database operations with the connection.
# Once complete, close the pool connection.
pool::poolClose(poolIMP); rm(poolIMP)
pool::poolClose(poolCSN); rm(poolCSN)

## End(Not run)


jgiacomo/AQRCxray documentation built on Nov. 19, 2022, 9:15 p.m.