问题
Would appreciate any tips regarding how to close MySQL connections in R.
Used dbDisconnect()
, but it kept throwing an error:
Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'dbDisconnect' for signature '"MySQLConnection"
回答1:
In order to disconnect you need to give dbDisconnect()
the right connection.
Make sure your connection does have a name in the first place. Always open a connection with
mydb <- dbConnect(..)
As soon as you don't need it anymore you can close it with
dbDisconnect(mydb)
来源:https://stackoverflow.com/questions/30363887/cant-close-mysql-connections-in-r