SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Guru augathra's Avatar
    Join Date
    Jul 2004
    Location
    united states
    Posts
    826
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why Close A DB Connection?

    Hi, Why should I close a DB connection?

    I have asked this question somewhat before, but never received a solid answer, like "it's good practice", but why?



    I appreciate any input.

  2. #2
    SitePoint Addict
    Join Date
    Nov 2003
    Location
    Malmoe, Sweden
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Many older programming languages has no way of automatically detect when you no longer referr to a resource. The only way to freeing this resource (memory) was to close the connection. This is usaully done automagicly these days so you might say itīs legacy to do so but thatīs not true either. As soon you get into persistent database connections you will now what I mean. If you learn to do whatīs "good practice" from the beginning you donīt have to unlearn it later and it will save you from pulling your hair completely. As we say in Sweden:
    Itīs not easy to teach an old dog to sit.


Bookmarks

Posting Permissions

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