Jump to content

Why can I not connect to local RODBC channel with R data function


Shea EVANS

Recommended Posts

I am trying tosend a dataframe into a local Access database. I have tested the code in Rstudio with no problems, but when I try as a Spotfire Data Function, I get the error:

"Error in sqlTables(conn) : first argument is not an open RODBC channel.

I have the connection stringset up correctly, and it works fine in RStudio. I have tried selecting "Force Local" under Edit Parameters, but that did not help. Here's the portion of the code that is causing me problems:

conn = odbcDriverConnect("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=")

WHcolumnTypes = list(API_NUMBER_10 = "VARCHAR(10)",

Well_Name = "VARCHAR(50)",

OPERATOR = "VARCHAR(50)",

ARIES_RESERVOIR = "VARCHAR(50)")

if ("WELL_INFO" %in% sqlTables(conn)$TABLE_NAME){

sqlDrop(conn, "WELL_INFO",errors = TRUE)}

sqlSave(conn, WH, tablename = "WELL_INFO", append = FALSE,

varTypes=WHcolumnTypes)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...