When connecting to a database using the dbConnect
function in the DBI
package, what are the best practices for securing logon information such as database name, username and password?
Entering logon information as a character text such as
library(RPostgreSQL)
drv = dbDriver("PostgreSQL")
con = dbConnect(drv, dbname = "<DBNAME>", host = "<HOST>",
port = 5432, user = "<USER>", password = "<PASSWORD>")
leaves the credentials open and in plain text. How can the logon information be protected when using it in an R script?