Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

C# MSSQL connection idle timeout.

  • 13-02-2013 03:49PM
    #1
    Registered Users, Registered Users 2 Posts: 7,544 ✭✭✭


    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, Registered Users 2 Posts: 14,722 ✭✭✭✭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, Registered Users 2 Posts: 7,544 ✭✭✭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, Registered Users 2 Posts: 12,025 ✭✭✭✭Giblet


    You're doing it right now.


  • Registered Users, Registered Users 2 Posts: 7,544 ✭✭✭BrokenArrows


    Whats wrong with persisting a connection anyway?


  • Registered Users, Registered Users 2 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, Registered Users 2 Posts: 7,544 ✭✭✭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