Extract error message for database not connected.
Add function for checking the username index.