user819783
user819783

Reputation: 61

How do I prevent other applications from connecting to SQL Server?

I have a Delphi application connecting to a remote SQL Server via ADO components.

How can I allow only my application access to SQL Server 2012 and any other application trying to connect should be thrown out?

Upvotes: 4

Views: 999

Answers (3)

George
George

Reputation: 84

You can use Application Role of SQL Server.

For me it makes no sense to lock whole SQL Server with Logon Trigger. There could be other databases and it should be also free for e.g. SQL Agent or for Management Studio or for Update-Program...

If you want to control access to database - use Users' and Application Roles. By App. Role you should call one stored procedure from your compiled code, and than all you can do will be defined by Application Role. If you disable access for other roles and users, nobody can access your database... Other databases could be also configured to give no permissions to other users/roles.

It makes more sense, has no problem with connection string and is flexible for other tasks.

Sorry for my english, it's not my native language.

Upvotes: 0

Jeroen Wiert Pluimers
Jeroen Wiert Pluimers

Reputation: 24523

The problem is that everything that connects to SQL Server does this by a ConnectionString.

If you really want, you can intercept those, and use them to fake to be another application.

As long as applications cannot in one way or the other use digital signatures to connect, there is no way to enforce what you want.

Upvotes: 3

da-soft
da-soft

Reputation: 7750

You should use Logon trigger and in this trigger compare APP_NAME() with a constant containing your application name. If they are different, then perform ROLLBACK.

Upvotes: 2

Related Questions