Hi,
Need your inputs of the approach to open the connection at application level or open and close the connection for every database interaction.
Here are the details of my application :-
I have 1 web application, 20-25 windows service and 10-15 Web services which uses 4 databases.
Some windows services also maintain the transaction.
Question : What is the best approach to manage the Database connection?
1. Is connection pooling a good idea ?
- but how connection pooling will work for the application running in different app domain
2. Is opening and closing db connection for every database interaction a good idea?
- my windows service hit the database very frequently, this may be a performance issue
3. Is keep a connection alive at application level is good?
- My Web services is hit by external application we can not determine how frequently they will hit the database. and I also read something on internet"The difficulty with long-lived connections is that you might not be entirely sure that they're still there. A network failure, server restart or stateful firewall forgetting some of its state could all result in a "stale" connection which looks open, but then gives an error when you try to use it."
Please suggest .
Kapul