Check if database is available and add reconnection functionality in case
we lose connection the database.