0

I have a database which holds all my permissions and a central database which holds all the logins for all my application. I need to create view that queries both database which reside on the same server. When I am in Sql Server Management Studio I can run the query with no problems. However, when I integrate it into my application I get a run-time exception.

Cannot open database "abc" requested by the login. The login failed.
Login failed for user 'WORKGROUP\HOME$' 

The error is obviously the permissions but I don't usually have to give access to this role. If the query is on the same server shouldn't the regular connection string and database permissions be sufficient?

4
  • It means the Computer 'WORKGROUP\HOME$' don't have access to SQL Server. You should create new login [WORKGROUP\HOME$] and grant sufficient permission to it. Commented Jul 2, 2019 at 5:03
  • Does the login that your application use have a mapped user in both databases?
    – Libertheme
    Commented Jul 2, 2019 at 5:05
  • Yes, I think I may have not configured networkserver for the application or rather database
    – jwize
    Commented Jul 2, 2019 at 5:15
  • If you add a user in the "abc" database for the application's login (assuming it is authenticating as the computer WORKGROUP\HOME$) that should give it access. Depending on which database your view is in you may need to explicitly grant SELECT to the tables or the db_datareader role if cross-database ownership chaining is not configured either.
    – Libertheme
    Commented Jul 2, 2019 at 6:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.