SQL User in Linked Table

DenSter
Member Posts: 8,307
I have 2 databases on my SQL Server, one of which is a Navision database. For this integration piece that I wrote I created views into the other one in the Navision database, and created linked tables to get to the data. Everything works fine, the users accepted the solution, so today we were ready to take it live.
Everything installed, views created, the sys admin at the customer was able to open the linked tables, so it all connects fine. Then, we added the first user to the system (to both databases, just like in testing), and the first time try to access any of the data, they get a SQL error 'user X is not a valid user on the database'. I verified this with my own eyes, and the user exists in both databases. The only way that we could make this work is to make the user system administrator on the SQL Server.
Does anybody here know how I can give regular database users access through these views without giving them system admin rights?
Everything installed, views created, the sys admin at the customer was able to open the linked tables, so it all connects fine. Then, we added the first user to the system (to both databases, just like in testing), and the first time try to access any of the data, they get a SQL error 'user X is not a valid user on the database'. I verified this with my own eyes, and the user exists in both databases. The only way that we could make this work is to make the user system administrator on the SQL Server.
Does anybody here know how I can give regular database users access through these views without giving them system admin rights?
0
Answers
-
Did you gave acces on the table/view to the user ?
I mean in Sql Server Enterprise manager-> Views-> All Tasks-> Manage Permissions?
:?:ovidiu
Best Regards0 -
I can't find views -> all tasks -> manage permissions. Please be more specific.
I don't think it is about permissions, for some reason it is not recognizing the user, so it is not even letting the credentials into the database. You first have to get into the database, and then after you are in, it worries about permissions to specific objects in the database. I need to know how to make SQL Server recognize the user without having to give it server admin rights.0 -
It can't be permissions. I set the user to db_owner, so that gives them all permissions. When I try to open the linked table in Navision it still gives me this message :916,"08004",[Microsoft][ODBC SQL Server Driver][SQL Server]Server user 'johnny' is not a valid user in database 'MyDatabase'0
-
0
-
Thank you Mark, I had found the same article, but it was no help. I tried all those suggestions and I still get the error.0
-
Okay, I found an answer. Read all about it here. The answer was to simply grant db_owner to all database users in the Navision database, and take away system administrator. I'm still not completely satisfied though, because not all users should have to be db_owner to get access to data.0
-
DenSter wrote:I can't find views -> all tasks -> manage permissions. Please be more specific.
I don't think it is about permissions, for some reason it is not recognizing the user, so it is not even letting the credentials into the database. You first have to get into the database, and then after you are in, it worries about permissions to specific objects in the database. I need to know how to make SQL Server recognize the user without having to give it server admin rights.
I meant: after you open a database in Enterprise Manager there are (diagrams, tables, views....). If you select a specific view you can find in properties -> all tasks-> manage permissions.
I don't know if it helps but I know that you must give permissions to a view if the user who wants to connect isn't a sys admin or db_ownerovidiu
Best Regards0 -
Ah now I see what you mean, thanks for explaining
. I tried the permissions on the view, and I even explicitly set the same permissions on the table itself, but as soon as I take away db_owner it says that the user is not a valid user in the target database.
0 -
DenSter wrote:Ah now I see what you mean, thanks for explaining
. I tried the permissions on the view, and I even explicitly set the same permissions on the table itself, but as soon as I take away db_owner it says that the user is not a valid user in the target database.
And now a stupid question. I've seen it at a client
Does the database the option from Database->Atler->Options->Acces
"Memebers of db_owner, dbcreator or sysadmin"
Activated ? :whistle:ovidiu
Best Regards0 -
May be that there is problem with the Shadow role (application role)... Navision create app role in the database which will be connecting... For each db is new app role created and granted permission for the DB.
Now, you have 2 DB and 2 App roles. You connect view in one DB to table in another DB. You start Navision, it connect with the app role to the 1st DB and try to read data from 2nd DB - no permission. Why? Because the app role have no rights to read data from 2nd DB...
May be that problem is there...
If the user is db_owner, he will be connected as db_owner and not as application role used by Navision... (it has higher priority)0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions