[R-sig-DB] RJDBC and dbWriteTable, append and overwrite options fail

MacQueen, Don m@cqueen1 @end|ng |rom ||n|@gov
Fri Jan 7 21:20:53 CET 2011


Using RJDBC I've created a functioning connection to an Oracle database
(some details omitted):

dbm <- JDBC('oracle.jdbc.OracleDriver', ¹path.to.jar¹, identifier.quote="`")
con <- dbConnect(dbm,  )

When I try to use dbWriteTable() with either append=TRUE or overwrite=TRUE,
I get an error. I've been able to use those options with Roracle.
See example below.

Is this a limitation in RJDBC, or am I missing something?

Thanks
-Don


> tsttbl <- data.frame(x=1:7, a=c('AA','BB',letters[1:5]))
> 
> dbWriteTable(con,'junk',tsttbl,row.names=FALSE)
[1] TRUE
> 
> dbGetQuery(con,'select * from junk')
  X  A
1 1 AA
2 2 BB
3 3  a
4 4  b
5 5  c
6 6  d
7 7  e
> 
> dbWriteTable(con,'junk',tsttbl,row.names=FALSE, append=TRUE)
Error in .local(conn, statement, ...) :
  execute JDBC update query failed in dbSendUpdate (ORA-00955: name is
already used by an existing object
)

---- yes, I need to upgrade to 2.12.1, and will, but the relevant packages
are current

> sessionInfo()
R version 2.12.0 (2010-10-15)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] RJDBC_0.1-5 rJava_0.8-8 DBI_0.2-5


-- 
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
925 423-1062




More information about the R-sig-DB mailing list