[R-sig-DB] RMySQL "lost connection" during dbWriteTable()

Magnus Thor Torfason zu|ut|me@net @end|ng |rom gm@||@com
Tue Oct 1 14:45:54 CEST 2013


When doing dbWriteTable() to write my (admittedly large) data.frame to a 
MySQL database I randomly get the following error:

 >     dbWriteTable(conn, "tablename", data)
Error in mysqlExecStatement(conn, statement, ...) :
   RS-DBI driver: (could not run statement: Lost connection to MySQL 
server during query)

Googling on MySQL in general suggests that this can be the result of 
sending too big of a chunk of data to MySQL at the same time.

But the data.frame sits comfortably in memory and the table sits 
comfortably in the database. So it is disappointing that what I thought 
was the recommended way to achieve this task (dbWriteTable), should be a 
bottleneck.

I suppose I could write a loop around dbWriteTable(), writing only a few 
rows of the data.frame at the same time, but that seems like something 
that dbWriteTable() should be doing internally.

Are there any good suggestions on what I should do?

Best,
Magnus




More information about the R-sig-DB mailing list