Hi,
I'm using R-2.8.1 for windows. I wrote a script calls the RODBC package to run sql queries against an oracle database. It runs fine when run from the rconsole and returns a data.frame with a summary for a set of experiments. I want to run this script using the rinterface.RunRFile command in an excel plugin, using the rexcel package. When I run the code from my excel plugin I get an error: "Error -2147220502 in Module RExcel.RServer Error running expression eval(parse(text="source(.rexcel..hzpouai)"))"


Here is my excel plugin code:
    rinterface.StartRServer
rinterface.RRun "setwd(""C:/Documents and Settings/bbolt/ Desktop"")"
    ChDir "C:/Documents and Settings/bbolt/Desktop"
    rinterface.RunRFile "Script.r"

It works fine if Script.r is something simple like:
Text <- data.frame(Hello="Hello")

But will give me the error when Script.R is something like:
inSet <- "TEST0000853"
library("RODBC")
query <- function(qu){
con <- odbcConnect ("Development ",uid="username",pwd="password",believeNRows=FALSE,rows_at_time=50)
        sqlQuery(con,qu)
        }
qu <- paste("m.parentid as SET from setmap m where m.childid in (select t.experiment from experimentsets t where t.setname='",inSET,"')",sep="")
ExperimentSet <- as.character(query(qu)[,1])

The error only occurs when I call my "query" function. Does anyone know if there is a way to run sql queries in this manner?

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to