2

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.

2
  • 1
    Which have you set, the ConnectionTimeout or the CommandTimeout(have to be set on each individual MySqlCommand objects) ? What did you set them to, and what happened (specifically, what happened including any error messages etc.)? Commented Mar 23, 2010 at 12:12
  • As i have written coonect timeout i have set in web.config to 180 & command timeout in my method call to 65535. Commented Mar 24, 2010 at 4:43

2 Answers 2

2

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;
Sign up to request clarification or add additional context in comments.

Comments

-1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.