0

Recently,I have to develop a system which will fetch huge data from SQL Server 2008 R2. And then need to create HL7 messages using these data and send these HL7 messages to another application. I need to fetch data and create HL7 messages within looping also. The problem I am facing is that connection time out when 1 or 2 minutes after running the application.How can I prevent this problem? What should I do?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Phyu
  • 11
  • 1
  • 6
  • 1
    command.CommandTimeout = 60; – Darshan Faldu Dec 21 '15 at 07:42
  • yes,I have already tried with connection timeout =60 in the connection string.But,still got the errors.Thanks for your comment. – Phyu Dec 21 '15 at 07:57
  • @Phyu CommandTimeout is not the same as Connection timeout. Check this link: http://stackoverflow.com/questions/847264/what-is-the-difference-between-sqlcommand-commandtimeout-and-sqlconnection-conne – spersson Dec 21 '15 at 08:00

1 Answers1

0

Modifying the connection string in the web.config , you could append ;Connection Timeout=30. The timeout value set in the Connection Timeout property is a time expressed in seconds.

Please Refer Connection Time out

setting the timeout value to 0, you are specifying that your attempt to connect waits an infinite time. As described in the documentation, this is something that you shouldn't set in your connection string. A value of 0 indicates no limit, and should be avoided in a ConnectionString because an attempt to connect waits indefinitely.

SH7
  • 732
  • 7
  • 20
  • Thanks for your answer.I have already tried with connection timeout=60 in the connection string.But, still got the connection time out problem. – Phyu Dec 21 '15 at 07:58
  • The 60 represents in Seconds. I hope your aware of that. – SH7 Dec 21 '15 at 08:00
  • Thanks, I aware of that. However,now I've tried with 200 seconds,still got the problem. – Phyu Dec 21 '15 at 08:02