[R] RODBC sqlSave problem.
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Apr 2 09:54:36 CEST 2003
On Wed, 2 Apr 2003, Fredrik Karlsson wrote:
> 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.
You would be: there is an extensive set of help pages, and you have not
looked up odbcConnect!
> 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?
Read the help page! odbcConnect has a `case' argument. There is even a
file tests.R with PostgreSQL examples in the distribution.
> I would, of course, be extremely greateful for all the help I can get.
I would be grateful if you would read the help pages before posting to
R-help.
More information about the R-help
mailing list