Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Posts
    1

    Unhappy Unanswered: SQL server connection closes randomly

    Hi,

    We have some console application which runs in background with the
    following logical flow :
    Main()
    {
    loop (1..n)
    {
    CreateThread(Function1)
    }
    }

    Function1()
    {
    Open SQLConnection;
    Loop Till No Data Found
    {
    Fetch N Records;
    For Each of N Records
    {
    Begin Transaction;
    Do DB Activity on the current record (Update);
    If Last operation Failed
    {
    DB Rollback;
    break;
    }
    If CommitFrequency reached
    {
    DB Commit;
    }
    }
    }
    Close SQLConnection;
    }

    After successfully executing some random number of records, the
    connection object is abruptly closing (In the line marked RED). It is giving "Connection Closed" exception on ExecuteQuery() call. Sometimes it is giving "Reader is already closed" while doing any Get() operation on the SQLReader object.

    We are using
    VS.Net 1.0 with SP4
    SQLServer 2000(no SPs)

    1) We are making a direct call to SQL server from the App Layer and not
    using COM+ .. to maintain transactions. Transactions are maintained
    purely by the Conn transaction Object.

    2) We have not specified any TimeOut property in the ConnectionString.
    (Anyway also tried giving a huge value just for testing).


    Is there any default timeout that is there in MS SQL and if yes how to offset it?

    Thanks
    Rings

  2. #2
    Join Date
    May 2003
    Location
    UK
    Posts
    220
    Is the connection pool used up?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •