get_sql_connection: Generate a dbConnect object to the SQL database

View source: R/pmap_db_utilities.R

get_sql_connectionR Documentation

Generate a dbConnect object to the SQL database

Description

This function generates a connection object. Note that most of the functions in pmapUtilities package require the specification of connection engine in the engine parameter of the function. However, all functions in the package requiring a connection will look for default_engine in the global environment, thus it is convenient (and recommended) to assign the return value of this to a variable called default_engine.

Usage

get_sql_connection(
  dbname = "master",
  username = NULL,
  password = NULL,
  server = "ESMPMDBPR4.WIN.AD.JHU.EDU",
  driver = "FreeTDS",
  tdsver = "8.0",
  verbose = F,
  trusted = F
)

Arguments

dbname

string name of database to connect to

username

username for the database connection

password

password (default is NULL); option to provide password; leave this blank will result in getPass being called for interactive entry of password

server

defaults to 'ESMPMDBPR4.WIN.AD.JHU.EDU', but another string server could be provided

driver

defaults to 'FreeTDS'

tdsver

defaults to "8.0"

verbose

(logical, default=FALSE; if TRUE will provide some details of the connection)

trusted

(logical, default=FALSE); if set to TRUE, will attempt a trusted connection using ODBC Driver 17 for SQL SERVER and Trusted_Connection="yes"

Value

Database connection object as returned by DBI::dbConnect()

Examples

default_engine = get_sql_connection(dbname = 'CAMP_PMCoE_Projection', username='<jhedid>')

lmullany/pmap_utilities documentation built on July 30, 2023, 8:54 a.m.