Fixed connection issues with the database when the connection was idle for some time.