[R] RODBC sqlSave problem.

Fredrik Karlsson fredrik.karlsson at ling.umu.se
Wed Apr 2 09:23:11 CEST 2003


Dear list,

Being new to both the postgres database, ODBC and the RODBC interface, I
am somewhat confused by some of the problems I am experiencing trying to
connect R to the database.

Whai I am trying is basically the example part of the help file for the 
sqlSave function:

> library(RODBC)
> odbcConnect("theodor") -> channel
> data(USArrests)
> sqlSave(channel, USArrests, verbose = TRUE)
Query: CREATE TABLE USArrests  (rownames varchar(255)  ,Murder float8
,Assault int4  ,UrbanPop int4  ,Rape float8  )
Error in sqlSave(channel, USArrests, verbose = TRUE) : 
        [RODBC] ERROR: Could not SQLExecute

When issuing this comamnd, a table is created in the specified database,
with fields corresponding to names(USArrests), except in lower case, but 
the fiels contain no data. 

Does anyone know the reason for this? One of my guesses is that the
table and field names are converted into lower cases by the database
manager, which would result in an error due to  non-existent symbols
when RODBC tries to inser the data.
Is this a possibility? Does anyone know how to investigate this?

Are there alternative explanations?

I would, of course, be extremely greateful for all the help I can get.



/Fredrik Karlsson



More information about the R-help mailing list