MySQL 5 delete database problems (and my solution)
-
23. listopadu 2011 14:56
Hello,
I think many of WSP users had this problem, that is being unable to delete a MySQL database while creating and other features properly work. I tried a lot of suggestions in these forums but none of them worked. I thought it could be a MySQL version problem (we were running a community 5.0.x) but upgraded to v5.5.x and it was not working anyway.
So I decided to drill into code and perform some debugging. It seems that exception occurs during KILLs aimed to close any existing connection for database and it seems that it doesn't happen inside WSP code but rather inside MySQL.Data library, which should be MySQL Connector for .NET, maybe when a KILL command has an invalid process ID.
I decided to modify code so when an exception occurs as a response to a KILL command, provider will go on. If any other command was involved, provider will re-throw that exception.
Tested a few times and it works. Sometimes an exception will be generated because of time-outs or other errors, probably when database is in use by other users but at least, if you try that a couple of times, it will work. Original code was *always* unable to delete database.
So I'm throwing this on forums just in case someone wants a quick fix. Being totally unable to delete databases was really a no-no for our customers, not considering that you would then need to detach database and manually delete it...
Hope this helps.
- Změněný typ The Bitland Prince 26. listopadu 2011 13:29 Was not a question