Cannot open database "db1" requested by the login. The login failed.

来源:互联网 发布:淘宝网店一颗心 编辑:程序博客网 时间:2024/05/20 17:41

今天一直出现这个问题,之前这个数据库都可以正常使用,在网上找了半天,这个应该是比较好的解决方式了。

 

Oh! I could solve it.

 

Let me share it so that other people can get the benefit if they fall in this problem:

 

 

Solution to the Problem:

 

I've just changed the authentication mode to sql authentication and then rewrite my connection string with the user name and password of the sql server. But remember to add Trusted_Connection=no;  in the connection string other wise it wont work.

 

Now it looks like:

"Server=localhost;Database=test;integrated security=sspi;Uid=sa;Pwd=test;Trusted_Connection=no;";

 

For help on how to change the authentication mode plz visit:

http://blogs.solidq.com/EN/rdyess/Lists/Posts/Post.aspx?ID=12

 

Now I think I don't need the ASPNET user anymore for accessing the database.

 

 

C、无法打开数据库 "MSCUPTDB"

  在"设置"对话框的"数据源"选项卡配置新服务器名称,显示以下消息:

  Cannot open database "mscuptdb" requested by the login. The login failed. Login failed for user 'username'

  排除此错误引起的故障时,请验证以下内容:

   必须在运行 SQL Server 的计算机上创建 mscuptdb 数据库。如果未创建数据库和数据库角色,请运行位于 Updates Publisher 安装文件夹的 CreatePubToolDb.sql SQL 脚本,以创建 mscuptdb 数据库和 System_Center_Updates_Publisher_User 数据库角色。

  安装 Updates Publisher 的用户必须具有访问 SQL Server 数据库的权限。用户必须具有 mscuptdb 数据库中的 System_Center_Updates_Publisher_User 数据库角色成员身份的 SQL Server 用户登录。