[R-sig-DB] Data type error with RpgSQL on Windows XP SP3 32bit

Gabor Grothendieck ggrothend|eck @end|ng |rom gm@||@com
Sun Oct 31 18:03:09 CET 2010


On Sun, Oct 31, 2010 at 9:26 AM, Dirk Eddelbuettel <edd using debian.org> wrote:
>
> On 31 October 2010 at 17:39, Xiaobo Gu wrote:
> | Hi,
> | Can you help with this
> |
> | > driver<-pgSQL(classPath="D:\\rtemp\\postgresql-9.0-801.jdbc4.zip")
> | > con <- dbConnect(driver, user="postgres", password="postgres",
> | dbname="demo")
> | > con
> | An object of class "pgSQLConnection"
> | Slot "jc":
> | [1] "Java-Object{org.postgresql.jdbc4.Jdbc4Connection using 1ce2dd 4}"
> |
> | Slot "identifier.quote":
> | [1] "\""
> |
> | > data <- dbGetQuery(con, "select * from optest.colana")
> | Error as.Date.default(.jcall(res using jr, "S", "getString", i)) :
> | do not know how to convert '.jcall(res using jr, "S", "getString", i)' to class
> | "Date"
> | >
> | the DDL is :
> | CREATE TABLE optest.colana
> | (
> | a integer,
> | b character varying(12),
> | c date,
> | d numeric
> | )
>
> Try casting the (SQL) date to (SQL) character, you can probably load the
> character into R and parse again as an (R) Date.
>

RpgSQL directly supports Date type.  It should not be necessary to
convert it to a character.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com




More information about the R-sig-DB mailing list