Singleton method to handle database class and avoid "too many connections" errors