SQL Connection Errors

  • Hello All,

    I have an SQL backend that I'm getting a lot of connection problems from. I've check all my code (C# in .NET), and I'm closing every connection that I open but I'm still getting the following errors (about 75 - 100 a day) :

    - System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

    - System.InvalidOperationException: Internal connection fatal error.

    - System.Exception: System.InvalidOperationException: Internal connection fatal error.

    Anyone know of what I can do to find out what the problem is or how to correct it so that I don't get these errors anymore? 

  • try using SQLCommand and setting the CommandTimout to a higher value 

    SqlCommand comm =

    new SqlCommand(strQuery, conn);

    comm.CommandTimeout =

    300;

    if you still get the errors after setting timout to something high like 5 minutes or so then i would suggest loooking at the sql logs or see if there is any network activity that would affect the timeout ..

    cheers

    dbgeezer

  • Try explicitly disposing of the connections. Simply closing them is not good enough. It leaves the connections in sql as orphaned connections. Check the locks thru Enterprise manager and you will find right at 99 or 100 open connections.  When this happens, sql will no longer accept connections until one of the others finally goes away. I have discovered that if you do a cnn.dispose, that this won't happen.

  • i don't know if this is true or ondicative of another problem.

    we had a three tier app that handled hundreds of connections with no problems. ASAIK sql server handles the connection pooling.

    cheers

    dbgeezer

  • Hi,

    To My knowledge if ur code is fine just have a look at the query that you are executing, possible the query u r executing is taking lot of time in return connection fails.

     

    Hope this helps u in your problem.

     

    Raj

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply