Hi All,
  There's a function called setSqlTypeInfo(driver,value) in RODBC package 
http://cran.r-project.org/web/packages/RODBC/index.html

Description
Specify or retrieve a mapping of R types to DBMS datatypes.

>From the package(RODBC) TypeInfo.r:

setSqlTypeInfo <- function(driver, value)
{
    if(!is.character(driver) || length(driver) != 1L)
        stop("argument 'driver' must be a character string")
    if(!is.list(value) || length(value) < 4L || is.null(names(value)) )
        stop("argument 'value' must be a named list of length >= 4")
    typesR2DBMS[[driver]] <<- value[c("double", "integer", "character", 
"logical")]
}

If I try to use it :
setSqlTypeInfo("Microsoft SQL Server",
list(double="float", integer="int",
character="varchar(255)", logical="varchar(5)"))

It gives me this error:

Error in typesR2DBMS[[driver]] <<- value[c("double", "integer", "character",  :
  cannot change value of locked binding for 'typesR2DBMS'

Actually, I am using RODM package 
(http://cran.r-project.org/web/packages/RODM/index.html ) which internally 
calls this function while making a connection to the Oracle DB. I am getting 
this error every time I try to make a connection.
https://forums.oracle.com/message/11030499
RODM_open_dbms_connection() try to make a call to setSqlTypeInfo().

*********

*********


`RODM_open_dbms_connection` <- function(
#
# Open an ODBC connection to the Oracle Database
#
dsn,
uid = "",
pwd = "")
{
  library(RODBC)

  channel <- odbcConnect(dsn = dsn, uid = uid, pwd = pwd, case = "toupper", 
rows_at_time=1)
  driver <- odbcGetInfo(channel)[[1]]
  setSqlTypeInfo(driver, list(double="double precision", integer="integer", 
character="varchar(255)", logical="varchar(255)"))

*********
*********

I am confused why would there be locked binding here.
Sorry , if I didn't post my question according to the guidelines. I am new to 
using R. Any suggestion will be appreciated.

Thanks
Mandeep



----------------------------------------------------------------------
This message, and any attachments, is for the intended r...{{dropped:5}}

______________________________________________
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