Why should we close a database connection? what can happen if a connection is left open? does the connection gets closed automatically when app exits?
Asked
Active
Viewed 213 times
3 Answers
1
1) Open connections as late as possible
2) Close connections as soon as possible
The connection itself is returned to the connection pool. Connections are a limited resource. Any new connection you establish that has exactly the same connection string will be able to reuse the connection from the pool.

santosh patar
- 66
- 5
0
It's not really necessary to close your database connection. See this question on stackoverflow for a more detailed explanation.
0
To release the resourcess like handler,we should use DBHelper.close(); to close Database, if you not close database,its may arise problem when you try to reconnect to Database. So to overcome this problem , we must close Database.

Rajendra
- 1,700
- 14
- 17