Iftekhar Ahmed
Iftekhar Ahmed

Reputation: 55

Use windows authentication in windows service

When running tomcat 7 as a windows service I can connect SQLServer with SQLServer Authentication but when connecting through Windows Authentication it seems to fail.

From what I know process running under windows services are user independent and run under a user named "SYSTEM" . Is there a way I can add SYSTEM to SQLServer users ?

Every thing seems to work if I run the code via Eclipse i.e. Under a user process.

Upvotes: 2

Views: 1854

Answers (1)

Abdul Mannan
Abdul Mannan

Reputation: 36

You need to add a new Login of your Machine (Machine where your service is running) on MS SQL Server machine. For example your are on domain "DomainName" and your hostname is "MachineName", you need to add a new Login "DomainName\MachineName$" on SQL Server. Note the $ sign at the end indicates that this is a computer name.

Follow the Steps below to add a new login on MS SQL Server:

  1. Open SQL Server Management Studio and Login as 'sa' user.
  2. Open Security -> Logins
  3. Right Click on Logins and New Login...
  4. Enter the Login name "DomainName\MachineName$" in General Tab
  5. Select Windows Authentication radio box
  6. Select tab "Server Roles" and check the box against "sysadmin"
  7. OK and then Restart your SQL Server Service.

Upvotes: 2

Related Questions