Description Usage Arguments Details Value Examples
Creates a connection to a database.
This function is really a high-level function that calls the corresponding
con_db
function for a particular database driver.
1 2 3 | con_db(dbname = Sys.getenv("LOGNAME"), user = Sys.getenv("LOGNAME"),
driver = "PostgreSQL", host = "postgresql", port = 5432,
close_existing_cons = TRUE, pass = NULL)
|
dbname |
the name of the database you want to connect to, defaults to current user |
user |
the username for the database connection, defaults to current user |
driver |
the database driver to use, defaults to 'PostgreSQL' |
host |
where the database is running, defaults to 'postgresql (the docker container name)' |
port |
the port where the database in running, defaults to '5432' for PostgreSQL |
close_existing_cons |
whether to close existing database connections, defaults to 'TRUE'. You need to set this to FALSE if you are planning to make simultaneous database connections. |
pass |
optional, defaults to NULL. If .dbpass exists in users home directory, password will be read from file (not advised). It will then try to run the 'sdalr::get_my_password()' function, if that fails it will prompt the user for a password. You can also directly pass in a password as a string (not advised). |
Best way to use this function is to make sure your username and passwords are stored safely. You can do this by running 'sdalr::setup_user_pass' (if you mistyped your password run 'sdalr::update_user_pass“).
database connection
1 2 3 4 5 6 7 8 9 10 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.