Winan,
I open a connection only when needed (user requests data, saves data, etc.), and then I close it.
Sometimes that's been out of necessity - one of my clients a while back would not let us install our app on their server until we could *prove* that we only opened connections on-demand.
While this goes beyond your question, there's an interesting thread from a while back (thread ID 825290) on the topic. If you do a search on 'open connection', you're likely to find other past discussions on it.
Kevin