[R] Rjdbc dbGetquery execution error

Gabor Grothendieck ggrothendieck at gmail.com
Thu Feb 17 13:24:44 CET 2011


On Wed, Feb 16, 2011 at 12:36 PM, Hasan Diwan
<diwan at economicriskmanagement.com> wrote:
> Rjdbc consistently gives me an execution error with postgresql 9.0s JDBC4
> driver. It's probably something trivial so am including my code below:
>
> library("RJDBC")
> param <- 249
> param2 <- 188129
> postgres <- JDBC("org.postgresql.Driver",
> ".m2/repository/postgresql/postgresql/9.0-801.jdbc4/postgresql-9.0-801.jdbc4.jar")
> con <- dbConnect(postgres, "jdbc:postgresql://hq.d8u.us/erm", user =
> "hdiwan")
> sql <- "select id, startdate, value from dists where profileid = ?"
> data1 <- dbGetQuery(conn, sql, param) # Dies here, no matter what the query,
> tried with "select 1+1" as well as the one above
> data2 <- dbGetQuery(conn, sql, param2)
> cor(data1$V3, data2$V3)
>

The RpgSQL package providesa PostgreSQL driver based on RJDBC,   See
?pgSQL for an example.



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



More information about the R-help mailing list