Is This Content Helpful?
We're glad to know this article was helpful.
Attempting to populate the Database drop-down list in the Database Connection dialog box returns an error:
"Unable to connect to database server to retrieve database list; please verify your server name, user name and password info and try again. Invalid database name."
Manually entering the database name returns an error:
"Failed to connect to the specified server. Do you want to continue? Invalid database name."
A connection file may be created but a connection cannot be made successfully.
If any of the following conditions are true the database list is not created and the connection fails:
• The connecting user has been added to the db_denydatareader role in any database, not just the one they are attempting to connect to.
• The connecting user is a member of a database role, including public, that has been added to the db_denydatareader role.
• The 'guest' user in any database has been added to the db_denydatareader role.
The built-in database role db_denydatareader exists in every database. Users who are added to this role cannot read any data in that database, regardless of any other explicitly granted or inherited permissions that may exist. Every member of a role added to db_denydatareader inherits this permission and is unable to read any data in the database.
The guest user is a built-in database user. Any permissions assigned to the guest user in a database are inherited by all the logins on the SQL Server instance, even if they are not users in that database.
Remove the user or role from the db_denydatareader role in all databases.
EXEC sp_helprolemember db_denydatareader
ALTER ROLE db_denydatareader DROP MEMBER user_name
EXEC sp_droprolemember 'db_denydatareader', 'user_name'
REVOKE CONNECT FOR user_name
CONNECT permission for the guest account can be revoked in the same way. As a security precaution, explicit permission on any database object should never be granted to the guest account.