Error Message Cannot open user default database. Login failed.

  • I am at a loss.  I am recieving this message Cannot open user default database. Login failed. through an application.  The login is a SQL Server Login and it can connect to the database directly in Management Studio and execute the stored procedure.  I have checked all of the groups it belongs to as well as the login itself and the default database exists.  We failed over a database this morning from a different database that this user is also a part of but it is not the default database.  Anyone have any thoughts?

  • I ran into this in a certain scenario where the login at the server level was not properly mapped to the SID of the user in the database. What you can do is use the stored procedure sp_change_users_login to fix the mapping between the login and the user and see if that works. Otherwise you might try changing their default database.

  • Already tried all of that.  Still isn't working

  • Change the users default database to master.

    I always make master the default database for all users.

     

  • I always make tempdb the default database for all users


    * Noel

  • Sounds to me like you have an orphaned user.  MSDN has a buncha info on them.

     

    Take a look at this: http://support.microsoft.com/kb/314546/

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply