Skip to content
Back to formatted view

Raw Message

Message-ID: <43ECD5A9.8040700@vanderbilt.edu>
Date: 2006-02-10T18:04:25Z
From: Jeffrey Horner
Subject: RODBC and BLOBS

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