'What's the most appropriate HTTP status code to return for connection failures on the server

What's the most appropriate HTTP status code to return for connection failures on the server? For instance, if the server fails to establish a connection to the database and sends "Could not establish a connection" as an error message. Is it okay to return 500 or 503?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source