SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Thread: Why Close A DB Connection?
-
Dec 29, 2004, 00:49 #1
- 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.
-
Dec 29, 2004, 03:39 #2
- 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