Masoud AMR February 2016

Lock database for other application

I'm using SQL Server 2008 R2, someone is using my database via a macro code in Excel, is there any way to prevent another application (like Excel) to access my database?

Answers


Daniele HoŇ°ek February 2016

Create a service (e.g.in C#.NET) which will be used to query the database. In programming language like C# you can easily lock the database via "lock" statement.


Kobi February 2016

If your users are supposed to acces the database (they have login and rights on it) but only with a limited range of software, you have to tell them not to use Excel. There is a workaround based on an after connect trigger wich check the application_name in session, but its not very effective.

If they do not have to connect directly to the database, you have to delete their logins (or revoke rights) or change password if they shared a common user.

Post Status

Asked in February 2016
Viewed 1,136 times
Voted 13
Answered 2 times

Search




Leave an answer