Access from NAV to a SQL view in different DB not allowed

bastir
Member Posts: 27
Hi,
I've created a simple sql view which is selecting date from a table in another database on same server.
Furthermore I've enabled this view in NAV, that user can read the data in a form/page.
But everytime a user tries to open this form/view he gets an Login-failure: "User ID and password are invalid"
Our users have public "right" on sql.
I've given them dbo rights on the other database but it didn't help.
When I try to access the data via Excel, everything works great.
It seems to me, that the NAV application role prevents me from accessing the external view.
Can anybody point me in the right direction how to solve the problem.
Thanks
Sebastian
I've created a simple sql view which is selecting date from a table in another database on same server.
Furthermore I've enabled this view in NAV, that user can read the data in a form/page.
But everytime a user tries to open this form/view he gets an Login-failure: "User ID and password are invalid"
Our users have public "right" on sql.
I've given them dbo rights on the other database but it didn't help.
When I try to access the data via Excel, everything works great.
It seems to me, that the NAV application role prevents me from accessing the external view.
Can anybody point me in the right direction how to solve the problem.
Thanks
Sebastian
0
Answers
-
Unfortunately You either have to enable the guest account and give that account access to You NAV db or setup the users that need to access the linke table as db_owner in the NAV db (along withpermissions in the database the view reads. I would prefer the latter since You still set the permissions inside NAV that restricts what the user can do inside NAV. However if the users gets hold of SQL Management Studio or any other tool and connects to the db they can do stuff You wouldn't like. But at least in this scenario You know who the user is. Only You can decide what suits your situation.
http://msdn.microsoft.com/en-us/library/dd355092.aspxLars Westman
http://www.linkedin.com/in/larswestman0 -
Hi Lars,
thanks for your reply.
Unfortunatly our users can use tools like SQL Mgt. Studio or even hav Excel installed (it is really to easy to use excel to access the data if you are db_owner)
But I also cannot move the tables from the other database to the NAV database.
Could you please explain me a little bit more the solution of the guest account.
Where do I've to enable the account.
Is it not possible to access the remote database from NAV with a user, that has db_owner rights in the target database.
Which user/role is logging in to the other database ndo$shadow or another user/role?
Thanks in advance
Sebastian0 -
As long as the user is not db_owner NAV uses a application role ($ndo$shadow in standard security model) to access the NAV db.
The application role is only known in the NAV db. Imho there are no chances to access an other db with an application role.
In that situation I always try to implement a solution where only a NAS needs to access the other DB and give the NAS account db_owner role.
Another alternative is to use a linked server. You can store credentials in the linked server configuration.
Your view uses the linked server to access the other db. So the view uses the credentials of the linked server.
I really don't like that solution, but it works ...
The last alternative I'm aware of, is to implement some kind of replication.
It depends on your needs, what the best solution is.
Tobias0 -
Hi Tobias,
thanks for the detailed answer, I also believed that the ndo$shadow role is preventing us from accessing the "remote" tables.
So I'll test a little bit more, strange that is is better to put the database to another sever and create a linked server connection, than setting credentials to the view.
I'm missing some statement likeCREATE VIEW foobar ... EXECUTE AS [UserWithDBOwnerRights]
the same you can use with stored procedures.
Best regards and "einen ruhigen ersten Advent"
Sebastian0 -
You can also create a "loopback" linked server (link the server with itself).
EXEC master.dbo.sp_addlinkedserver @server = N'LOCALHOST', @srvproduct=N'SQL Server'
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'LOCALHOST',@useself=N'False',@locallogin=NULL,@rmtuser=N'userWithPermission',@rmtpassword='########'
Really nasty...
Dir auch einen ruhigen ersten Advent.
Tobias0 -
But the main issue remains: You still need to be db_owner in the NAV database to access data outside the NAV db.Lars Westman
http://www.linkedin.com/in/larswestman0 -
No, not with the linked server approach.
Tobias0
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