1

I have a scenario in My programmer to check database connection and if database connection available then proceed else try to reconnect it. I want to fetch DB time using "SELECT GETDATE()" statement. First time when DB connects it runs successfully and when after disconnect and connect DB and trying to fetch DB time it give me below error.

A transport-level error has occurred when sending the request to the server. (Provide: TCP Provider, error: 0 – An existing connection was forcibly closed by the remote host).

Can anyone help me to sort out this Problem?

Jankya
  • 966
  • 2
  • 12
  • 34
  • Duplicate of [Connection problems with SQL Server in ASP.NET applications using out-of-process session state](http://stackoverflow.com/questions/810673/connection-problems-with-sql-server-in-asp-net-applications-using-out-of-process) - did you enable TCP in your server configuration? – CodeCaster Oct 28 '13 at 09:10
  • 3
    "check database connection and if database connection available then proceed" - but since your program doesn't completely control the connection state, there's no point in checking first - by the time you attempt to proceed, the connection state might have changed - or it may part way through using it. There's no amount of pre-checking you can perform that prevents you having to deal with connection problems when you're actually doing the work you wanted to do. – Damien_The_Unbeliever Oct 28 '13 at 09:10

0 Answers0