mysql Command timeout error

你说的曾经没有我的故事 提交于 2019-12-12 18:08:07

问题


I am converting my database from SQL Server 2005 to MySQL using asp .net mvc.

I have bulk data in SQL Server (400k records), but I am facing command timeout/waiting for CommandTimeout error which, when I search on Google, can be given 65535 as its highest value or 0 (if it should wait for unlimited time).

Both of these aren't working for me. I also have set any ConnectTimeout to 180. So should I have to change it too? Anybody who had faced this problem or have any confirmed knowledge please share.


回答1:


For me increasing the CommandTimeout fixed the issue.

Code sample:

//time in seconds
int timeOut = 300;
//create command
MySqlCommand myCommand = new MySqlCommand(stringSQL);
//set timeout
myCommand.CommandTimeout = timeOut;



回答2:


Try sending commands in a batch of 100/500 then there will be no need of command timeout. Hope it works for you



来源:https://stackoverflow.com/questions/2499603/mysql-command-timeout-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!