[R-sig-DB] RODBC and BLOBS

Jeffrey Horner je||@horner @end|ng |rom v@nderb||t@edu
Fri Feb 10 19:04:25 CET 2006


Does RODBC support BLOBS? I ask because I would like to 
serialize(ascii=FALSE) an R variable and store it in a database table.
Is this doable?

My naive attempt went like this:

 > library(RODBC)
 > chan <- odbcConnect('test') # to mysql thru myodbc thru unixodbc
 > sqlQuery(chan,"create table vars( name varchar(255), val blob)")
[1] "No Data"
 > data(iris)
 > x<-serialize(iris,connection=NULL)
 > sqlQuery(chan,paste("insert into vars VALUES ('iris','",x,"')",sep=''))
character(0)
 > y<- sqlQuery(chan,"select * from vars")
 > z<-unserialize(y$val)
Error in unserialize(y$val) : 'connection' must be a connection
 > typeof(y$val)
[1] "integer"

-- 
Jeffrey Horner       Computer Systems Analyst         School of Medicine
615-322-8606         Department of Biostatistics   Vanderbilt University




More information about the R-sig-DB mailing list