When I develop a web app, I open and close connections on each page,
executing multiple commands as necessary within the single open connection.
However, I recently ran into a group of people that create a global
connection for their web applications and share it across
sessions/users/pages. Both models "work", but the second method makes me
cringe ... unfortunately I can't seem to put my cringe into words as to why
one should open and close connections locally.
I'd appreciate your feedback.
The reasons I can come up with:
1. Global variables should be avoided in general
2. Why keep a connection open all the time? Close it when it's not in use.
3. Multiple connections could potentially result in better performance for a
large number of concurrent users.
Others?
Thanks in advance!
mark