PRSQL9202020: Login with no User Name Cannot Log In

ID Number: Q82944

1.10 1.11

OS/2

buglist1.10 buglist1.11 fixlist4.20

Summary:

Problem ID: PRSQL9202020

SYMPTOMS

When a user attempts to log in to SQL Server, the following errors

are returned and the user's login attempt is unsuccessful:

Server user id <user id> is not a valid user in database <db name>.

(Msg 916, Level 14, State 1)

Cannot open default database <db name>.

(Msg 4001, Level 11, State 1)

CAUSE

The above errors may occur when a login ID has been assigned a

default database, but no user name is associated with that login ID

in the default database. In this case, when a user attempts to log

in to SQL Server using that login ID, the above errors should be

displayed, and SQL Server should connect the user to the master

database, treating that user as a guest user. SQL Server

incorrectly handles this scenario, and rather than logging the user

into the master database, denies that user access to any database

until a user name has been assigned to the login ID in the default

database.

WORKAROUND

There are two methods of working around this problem:

- The database owner (DBO) can use sp_adduser to add a user name

for that login ID in the default database.

-or-

- Add a "guest" account to the default database. If the default

database has a guest account, then any login ID that defaults to

that database but has no associated user name will be logged into

that database as a guest user.

STATUS

Microsoft has confirmed this to be a problem in SQL Server version

1.1 and 1.11. This problem does not occur in SQL Server version

4.2.

Additional reference words: 1.10 4.20