开发者

security context problem when accessing through synonyms

开发者 https://www.devze.com 2023-02-27 18:46 出处:网络
There is a user and two databases on server (db1 and db2). User can connect to server having default database db1 where he can exec sp.

There is a user and two databases on server (db1 and db2). User can connect to server having default database db1 where he can exec sp. In sp syntax we use synonyms for db2 tables under dbo scheme.

All that is done in order to allow user just connect and exec one stored procedure. It worked noraml but now The server principal "user" is not able to access the database "db2" under the current security context.

User gets output from sp when code does not touch synonyms to db2. What should be updated? I cant grant select to开发者_如何学Python user for db2 objects.

security context problem when accessing through synonyms


I know the question is old, but still relevant

  • the procedure has to have permission on the synonym object
  • the procedure has to have permission on the object the synonym is targeting
  • you have to correctly setup trustworthy database property

By default, the procedure executes under the caller account, but it can be changed with execute as clause.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号