SQL Server Error: 4064

  • Hi,

    One of the application guys are configured an ODBC connection to a particular server.  He switched back to another server, but now he's getting the following error when he is trying to configure again:

    Connection failed

    SQLState: '4200'

    SQL Server Error: 4064

    [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open user default database. Login failed.

    Can you please help. I have not changed anything on the databases, I have just restored them. I don't think this could be the problem.

     

  • Make sure that his defaultdb is master, and that he has access to it (at least public), and of course access to the db he wants to connect to.  That should give him back access to the system.

  • Did the user in the database you restored (I'm assuming that is the users default database) get synched with the login?

  • sp_change_users_login 'auto_fix', 'yourlogin'

    Run the above statement in the restored database.

     

    Alex S
  • I just had a similar error message but it was happening when I tried to open Management Studio to an instance where I had just deleted a test database (just happened to be the default database for the NT group used by my login). When I logged in under sa (default = master) and checked the properties of the NT Login group the default database was blank. I picked another database and the NT login works.

  • This was removed by the editor as SPAM

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

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