throw an exception when database connection fails