[R-sig-DB] RJDBC dbWriteTable() overwrite=TRUE not working?

MacQueen, Don m@cqueen1 @end|ng |rom ||n|@gov
Sat Feb 26 02:02:34 CET 2011


I have the following experience with package RJDBC, working with an Oracle database.

Jdbm <- JDBC(  �correctly defined, I believe�)
Jcon <- dbConnect(jdbm,  �correctly defined, I believe�)

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

I get the same error with append=TRUE.

Am I doing something wrong?

I know that I can use dbRemoveTable() first, but I had expected dbWriteTable with overwrite=TRUE to succeed.

Thanks
-Don

> sessionInfo()
R version 2.12.2 (2011-02-25)
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


The Oracle is 11.2.0
For what it's worth, I get the same problem with an older system:
   R (2.10.1);  Oracle 10g;  Mac OS 10.5.8.

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062


	[[alternative HTML version deleted]]




More information about the R-sig-DB mailing list