Set database connection settings for the session
Arguments
- db_settings
A list of database connection settings (see example)
- driver
A database driver. Common database drivers include
MySQL,PostgreSQL, andMariaDB. Seeunique(odbc::odbcListDrivers()[[1]])for a list of locally available drivers.- host
Host address, e.g. "localhost".
- port
Port to use to connect to the database.
- database
Database name.
- user
Database user name.
- pwd
Password for the database user.
Examples
# \donttest{
if (interactive()) {
# Settings can be provided either as a list
db_settings <- list(
driver = "MySQL",
host = "localhost",
port = 3306,
database = "castarter",
user = "secret_username",
pwd = "secret_password"
)
cas_set_db(db_settings)
# or as parameters
cas_set_db(
driver = "MySQL",
host = "localhost",
port = 3306,
database = "castarter",
user = "secret_username",
pwd = "secret_password"
)
}
# }