Using R.Net running an R-script using RODBC: "first argument is not an open RODBC channel"

21 Views Asked by At

Running this script from within R works fine.

library(RODBC)
con<- RODBC::odbcConnect("NewEHMP", uid = "", pwd = "")
arr<-RODBC::sqlFetch(con, "AllEHMPSites", max = 10)
odbcCloseAll()

Running the same script from VS20129 VB.Net using R.Net:

m_REngine.Evaluate("source('" + scriptpath + "')")

traps the following error: 'RDotNet.EvaluationException: 'Error in RODBC::sqlFetch(con, "AllEHMPSites", max = 10) : first argument is not an open RODBC channel'

Note that other scripts run via R.Net work fine as long as it does not use an RODBC connection. Any suggestions would be very welcome. Cheers

Tried different connection strings and different RODBC sql approached (sqlQuery, sqlFetch). As the script runs fine from within R but false using R.Net, it seems a R.Net problem to me.

0

There are 0 best solutions below