R/w2_online.R
w2_online.Rd
This function requires an installed ODBC driver for MS SQL Server 2012. The database credentials are handled via environment variables.
w2_online(
db_drv = Sys.getenv("W2_DRV"),
db_srv = Sys.getenv("W2_SRV"),
db_name = Sys.getenv("W2_DB"),
db_user = Sys.getenv("W2_UN"),
db_pass = Sys.getenv("W2_PW"),
db_port = Sys.getenv("W2_PT"),
verbose = wastdr::get_wastdr_verbose(),
dsn = Sys.getenv("W2_DSN"),
use_rodbc = Sys.getenv("W2_RODBC", FALSE)
)
Database driver, default: Sys.getenv("W2_DRV")
which should
resolve to e.g. "/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so"
.
Database server, default: Sys.getenv("W2_SRV")
, which should
resolve to a valid server hostname, e.g. "myserver.corporateict.domain"
.
The database name, default: Sys.getenv("W2_DB")
, which should
resolve to a valid database name, e.g. turtle_tagging
.
The read-permitted database user,
default: Sys.getenv("W2_UN")
.
The database user's password, default: Sys.getenv("W2_PW")
.
The database port, default: Sys.getenv("W2_PT")
, which
should resolve to a numeric port, e.g. 1234
.
Whether to show debug messages. Default: wastdr::get_wastdr_verbose()
The DSN for Windows systems, default: Sys.getenv("W2_DSN")
.
Whether to use the RODBC library (if TRUE, best for Windows systems), or the odbc/DBI library (if FALSE, default, best for GNU/Linux systems).
(lgl) TRUE if WAMTRAM2 is accessible and online, else FALSE.
In Windows systems, create a user defined DSN with settings
name WAMTRAMPROD
server kens-mssql-001-prod.corporateict.domain
SQL auth using login ID and password entered by user
trust server certificate (this is where odbc falls over)
Add to .Renviron: W2_RODBC=TRUE W2_DSN="WAMTRAMPROD"
Other wamtram:
download_w2_data()
,
map_wamtram()
if (FALSE) {
# Credentials are set in .Renviron
w2_online()
#> TRUE
#> FALSE
}