I am using RJDBC for accessing MySQL from R. Earlier I used to work with RMySQL which is not available for R 2.15. There were so many discussions around SO but still I couldn't able to use RMySQL package in R 2.15 so switched to RJDBC.
When I'm using dbWriteTable(..., append = T)
command for appending records into MySQL table it is simply overwriting, please see the code below.
setting environment variable for MySQL server
Sys.setenv(MYSQL_HOME='C:/Program Files (x86)/MySQL/MySQL Server 5.1')
library(RJDBC)
MySQL connection
drv <- JDBC("com.mysql.jdbc.Driver","mysql-connector-java-5.0.5.jar", "`")
conn <- dbConnect(drv, "Retail", user="root", password="abc")
..................
..................
..................
dbWriteTable(conn, "Customer_Tbl", x, row.names=F,append = T)
Customer_Tbl
is overwriting everytime instead of appending.
Can somebody help in how to tackle this issue?
Thanks Suresh
You need to use overwrite=FALSE, following sample code: