Add exception handling on failed database connection

When the backend cannot establish a database connection, it crashes with an unhandled error. The backend should display a proper logged error message instead.