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

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Sun Oct 31 14:26:48 CET 2010


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.

RPostgreSQL could do that in one step, but we'd still need a volunteer to
help build a libpq.a library for Windows/MinGW before a binary package can be
provided.

Dirk

-- 
Dirk Eddelbuettel | edd using debian.org | http://dirk.eddelbuettel.com




More information about the R-sig-DB mailing list