user2132252
user2132252

Reputation: 49

Connection timeout after 30 seconds

I have a C# program connecting to a MYSQL database. The stored procedure takes longer than 30 seconds so the connection times out. What I'm looking to do is to increase the alloted time to do the stored procedure to 5 minutes. I know that the default time out is 30 seconds and need to increase the alloted time. Is it possible to do this in C# or do I need to perform less stored procedures?

Upvotes: 2

Views: 4288

Answers (2)

Aghilas Yakoub
Aghilas Yakoub

Reputation: 28970

You can also configure your timeout in your string connection by using Connect Timeout property

Config File : "Data Source=;Initial Catalog=;Connect Timeout=...."

Upvotes: 2

MarcF
MarcF

Reputation: 3299

Where you create your sql query command:

command.CommandTimeout = int.MaxValue;

or set int.MaxValue to the timeout of your choice.

Upvotes: 0

Related Questions