ProgrammerJam
ProgrammerJam

Reputation:

Connection timeout

Im getting this error:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding

"Data Source=" + server + ";Initial Catalog=" + database + ";Integrated Security=SSPI;Connection Reset=False;"

Connection pooling is default to true and I am closing all connections.

Any ideas?

Upvotes: 0

Views: 1099

Answers (4)

Apoorv Kulkarni
Apoorv Kulkarni

Reputation: 39

Please try the connnection string as follows

You can try any one of them, Connect Timeout=0 or Connection Timeout=0

"Data Source=" + server + ";Initial Catalog=" + database + ";Integrated Security=SSPI;Connection Timeout=0;"

Connect Timeout=0 or Connection Timeout=0 meaning infinite time for the operation to run

refer the following MSDN Link

Upvotes: 1

erikkallen
erikkallen

Reputation: 34421

Could be that the SQL server does not allow incoming TCP/IP connections (which is the default setting).

Upvotes: 1

Nathan Koop
Nathan Koop

Reputation: 25197

Is this problem occuring on only one page? or is it a global issue?

Are you aware of what query is causing the timeout?

  • If not, you should add try/catches around your database calls and log your errors to determine where it is.
  • If so, can you run that query from your database tool? (IE SQL Server Management Studio)
    • Does your query succeed? or does it timeout?
    • Does it take a long time? Can you improve the performance of that query?

Upvotes: 0

Scoregraphic
Scoregraphic

Reputation: 7210

Try setting ConnectionTimeout and/or CommandTimeout (if working on .NET). A timeout of 0 means "no timeout"

Upvotes: 2

Related Questions