(bug-fix:minor) Connection should be "released" not closed.
(change:major) Refactor code related to DB connection management and put into a new separate class (DatabaseConnectionPooling).