connectODBC | R Documentation |
Creates connection to ODBC database using the data contained in keyrings. This is generally used for internal purposes at MARC to make database connections a lazier proccess with keryring.
connectODBC(databaseString = NULL)
databaseString |
Same as the username saved in the keyring. Default NULL will list the available keys under the service 'DB_conn' |
Keys should be set up prior to using the function to a style similar to:
keyring::key_set("DB_conn", username = "<serverName>.<databaseName>.<userName>")
The password should then be set to the connection string formatted like:
"Driver={ODBC Driver 17 for SQL Server};Server=<serverName>;Database=<databaseName>;UID=<userName>;PWD=<password>;
"
Leave the PWD section in the username argument written as PASSWORD as this
is automatically replaced with the stored password when calling
connectODBC()
.
OBDC connection object returned from DBI::dbConnect()
First created in 2020-Sept for easily accessing databases in R
Jacob Peterson
## Not run: library(glue) library(magrittr) library(DBI) con <- connectODBC("<serverName>.<databaseName>.<userName>") DBI_getOBDCtable(con, "SELECT * FROM <schemaName>.<tableName>") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.