cas_connect_to_db | R Documentation |
Return a connection to be used for caching
cas_connect_to_db(
db_connection = NULL,
use_db = NULL,
db_type = NULL,
db_folder = NULL,
read_only = FALSE,
...
)
db_connection |
Defaults to NULL. If NULL, uses local SQLite database. If given, must be a connection object or a list with relevant connection settings (see example). |
use_db |
Defaults to NULL. If given, it should be given either TRUE or
FALSE. Typically set with |
read_only |
Defaults to FALSE. Passed to |
... |
Passed to |
A connection object.
Other database functions:
cas_check_db_folder()
,
cas_check_use_db()
,
cas_create_db_folder()
,
cas_disable_db()
,
cas_disconnect_from_db()
,
cas_enable_db()
,
cas_get_db_settings()
,
cas_read_from_db()
,
cas_set_db()
,
cas_set_db_folder()
,
cas_write_to_db()
if (interactive()) {
db_connection <- DBI::dbConnect(
RSQLite::SQLite(), # or e.g. odbc::odbc(),
Driver = ":memory:", # or e.g. "MariaDB",
Host = "localhost",
database = "example_db",
UID = "example_user",
PWD = "example_pwd"
)
cas_connect_to_db(db_connection)
db_settings <- list(
driver = "MySQL",
host = "localhost",
port = 3306,
database = "castarter",
user = "secret_username",
pwd = "secret_password"
)
cas_connect_to_db(db_settings)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.