r-dbi/DBI

dbAppendTable doesn't work

blmayer opened this issue · 3 comments

I am connected with a MySQL database with "mySchema.myTable" already there and when I execute the command:

> dbAppendTable(conn, "mySchema.myTable", myValues) Error in .verify.JDBC.result(r, "Unable to retrieve JDBC result set for ", : Unable to retrieve JDBC result set for INSERT INTO "mySchema.myTable"

Then it prints my column names and

In addition: Warning message: In if (is.na(v)) { : the condition has length > 1 and only the first element will be used

Can someone help me?

Thanks

Also, documentation says to use dbSendStatement to issue data manipulation statements, e.g. INSERT, UPDATE, DELETE, but the command:

dbSendStatement(conn, "INSERT into mySchema.myTable values (val1, val2, ...)")

returns

Error in .verify.JDBC.result(r, "Unable to retrieve JDBC result set for ", : Unable to retrieve JDBC result set for INSERT into mySchema.myTable values (val1, val2, ...) (Can not issue data manipulation statements with executeQuery().)

I'm using DBI package version 1.0.0

Thanks. Could you please post a more complete example? How does your dbConnect() call look like?

Seems you're using RJDBC where you need to use dbSendUpdate instead of dbSendStatement (IMO RJDBC is not implementing the DBI interface correctly). There's also a native MySQL client called RMariaDB which probably works better than RJDBC.