Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

C# MSSQL connection idle timeout.

Options
  • 13-02-2013 3:49pm
    #1
    Registered Users Posts: 7,501 ✭✭✭


    Im connecting to an MSSQL 2005 and 2008 server in my C# project and getting some information.

    Im leaving the connection open until the user closes the program and at that point i close the connection to the database.

    What im trying to find out is if there is a Idle timeout on the server side in MSSQL.

    If the user leaves the program open for a period of time will the server kill the connection? I cant seem to find a definitave answer with google.


Comments

  • Registered Users Posts: 14,714 ✭✭✭✭Earthhorse


    I hate to answer a question with a question but is there a reason you need to persist the connection in this manner?


  • Registered Users Posts: 7,501 ✭✭✭BrokenArrows


    Earthhorse wrote: »
    I hate to answer a question with a question but is there a reason you need to persist the connection in this manner?

    Not really no.

    Ive actually changed it since asking this question to connect/disconnect after every query because i couldnt find a definate answer to the question.


  • Registered Users Posts: 11,979 ✭✭✭✭Giblet


    You're doing it right now.


  • Registered Users Posts: 7,501 ✭✭✭BrokenArrows


    Whats wrong with persisting a connection anyway?


  • Registered Users Posts: 7,157 ✭✭✭srsly78


    It hogs resources. What would happen if you had hundreds of clients that all kept their connections open?


  • Advertisement
  • Registered Users Posts: 7,501 ✭✭✭BrokenArrows


    srsly78 wrote: »
    It hogs resources. What would happen if you had hundreds of clients that all kept their connections open?

    Ok fair enough.

    Hadnt really considered that because its not going to happen in my scenario but its probably good practice to close stuff when im done.


Advertisement