-->

Can't close mysql connections in R

2019-07-13 06:03发布

问题:

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)


标签: r rmysql