[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

"Connect Timeout" doesn't have effect

Posted on 2008-10-16
3
Medium Priority
?
336 Views
Last Modified: 2013-12-17
Hello, experts.
I have an SQL Server 2005 Express Edition, wich I access from my C# 2008 application. The table I work with is pretty big and it takes more than 30 seconds to execute some of the stored procedures, so I set "Connect Timeout=300" in a connection string. It doesn't have any effect, though: after 30 seconds the ExecuteReader command throws an exception "Timeout expired". When I execute the stored procedure from Management Studio, it completes successfully (takes about a minute), and it worked fine from code when the table was smaller, so I'd say the error message is correct and it looks like there is some setting elsewhere, which limits the timeout to 30 seconds.
Does anybody have a clue where it might be?
0
Comment
Question by:nebfis
3 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 1000 total points
ID: 22731494
Hello nebfis,

You don't want to be setting the "CONNECT" timeout, this does what it says on the tin! If the CONNECTION has not been made in the specified time then it stops trying. It does not affect the time for the command itself to execute. For this you need to set the .CommandTimeout property of the sqlCommand object to a suitable period, perhaps 90 seconds to allow a bit of breathing space.

Regards,

TimCottee
0
 
LVL 6

Expert Comment

by:mirzas
ID: 22731540
"Connect Timeout" -> this is only used when you are initially connecting to the server.

It just means how long will the client try to connect to the server. Once you have established a connection this has no more effect.
0
 

Author Closing Comment

by:nebfis
ID: 31506754
Thank you, TimCottee. You were absolutely right. I tried it and it works flawlessly.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question