Skip to contents

Connect to a Virtuoso Server over ODBC

Usage

vos_connect(
  driver = NULL,
  uid = "dba",
  pwd = "dba",
  host = "localhost",
  port = "1111",
  system_odbcinst = find_odbcinst(),
  local_odbcinst = odbcinst_path()
)

Arguments

driver

Name of the Driver line in the ODBC configuration

uid

User id. Defaults to "dba"

pwd

Password. Defaults to "dba"

host

IP address of the Virtuoso Server

port

Port used by Virtuoso. Defaults to the Virtuoso standard port, 1111

system_odbcinst

Path to the system odbcinst.ini file. (Does not require write access.) Default will attempt to find the file for your system.

local_odbcinst

Path to the local odbcinst we should use.

Value

a DBI connection to the Virtuoso database. This can be passed to additional virtuoso functions such as vos_import() or vos_query(), and can also be used as a standard DBI or dplyr database backend.

Details

Default parameters are appropriate for the automatic installer provided by the package and for the default settings typically used by local Virtuoso installers. Adjust these only if you are connecting to a remote virtuoso server that is not controlled from the R package.

Examples

status <- vos_status()
#> virtuoso isn't running.
# \donttest{
if(has_virtuoso()){
## start up
vos_start()
con <- vos_connect()
}
#> Warning: Exiting, virtuoso template not found... is virtuoso installed?
#> PROCESS 'virtuoso-t', running, pid 2711.
#> Server is now starting up, this may take a few seconds...
#> virtuoso isn't running.
#> Warning: could not automatically locate virtodbc.so
#> Error in base::tryCatch(base::withCallingHandlers({    NULL    base::saveRDS(base::do.call(base::do.call, base::c(base::readRDS("/tmp/RtmpEoVaWd/callr-fun-844871e13"),         base::list(envir = .GlobalEnv, quote = TRUE)), envir = .GlobalEnv,         quote = TRUE), file = "/tmp/RtmpEoVaWd/callr-res-829e574f5",         compress = FALSE)    base::flush(base::stdout())    base::flush(base::stderr())    NULL    base::invisible()}, error = function(e) {    {        callr_data <- base::as.environment("tools:callr")$`__callr_data__`        err <- callr_data$err        if (FALSE) {            base::assign(".Traceback", base::.traceback(4), envir = callr_data)            utils::dump.frames("__callr_dump__")            base::assign(".Last.dump", .GlobalEnv$`__callr_dump__`,                 envir = callr_data)            base::rm("__callr_dump__", envir = .GlobalEnv)        }        e <- err$process_call(e)        e2 <- err$new_error("error in callr subprocess")        class <- base::class        class(e2) <- base::c("callr_remote_error", class(e2))        e2 <- err$add_trace_back(e2)        cut <- base::which(e2$trace$scope == "global")[1]        if (!base::is.na(cut)) {            e2$trace <- e2$trace[-(1:cut), ]        }        base::saveRDS(base::list("error", e2, e), file = base::paste0("/tmp/RtmpEoVaWd/callr-res-829e574f5",             ".error"))    }}, interrupt = function(e) {    {        callr_data <- base::as.environment("tools:callr")$`__callr_data__`        err <- callr_data$err        if (FALSE) {            base::assign(".Traceback", base::.traceback(4), envir = callr_data)            utils::dump.frames("__callr_dump__")            base::assign(".Last.dump", .GlobalEnv$`__callr_dump__`,                 envir = callr_data)            base::rm("__callr_dump__", envir = .GlobalEnv)        }        e <- err$process_call(e)        e2 <- err$new_error("error in callr subprocess")        class <- base::class        class(e2) <- base::c("callr_remote_error", class(e2))        e2 <- err$add_trace_back(e2)        cut <- base::which(e2$trace$scope == "global")[1]        if (!base::is.na(cut)) {            e2$trace <- e2$trace[-(1:cut), ]        }        base::saveRDS(base::list("error", e2, e), file = base::paste0("/tmp/RtmpEoVaWd/callr-res-829e574f5",             ".error"))    }}, callr_message = function(e) {    base::try(base::signalCondition(e))}), error = function(e) {    NULL    if (FALSE) {        base::try(base::stop(e))    }    else {        base::invisible()    }}, interrupt = function(e) {    NULL    if (FALSE) {        e    }    else {        base::invisible()    }}): ! ODBC failed with error 00000 from [unixODBC][Driver Manager].
#>  Can't open lib 'virtodbc.so' : file not found
#>  From nanodbc/nanodbc.cpp:1150.
# }