connect: Establishes a connection to the database

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Establishes a connection to the database

Usage

1
2
3
4
5
6
7
8
connect(
  database = NULL,
  host = "localhost",
  port = 5432,
  username = NULL,
  password = NULL,
  sqlite_file = NULL
)

Arguments

database

target db

host

db host: typically "localhost"

port

db port number

username

db username

password

db password

sqlite_file

filename as character vector if using an sqlite db (in which case this is the only argument that needs to be supplied)

Value

a database object connection

Examples

1
2
3
4
db_pth <- system.file("testdata/synthetic_db.sqlite3", package = "inspectEHR")
ctn <- connect(sqlite_file = db_pth)
class(ctn)
DBI::dbDisconnect(ctn)

CC-HIC/inspectEHR documentation built on Jan. 16, 2020, 11:24 p.m.