Extracted method validateDatabaseName for checking whether database name is invalid.