views:

91

answers:

3

I am running a Java Application as a Service in Windows that's using JDBC to connect to SQL Server. This application is started as a different user than the one logged into the Machine. My question is will the JDBC Driver use the user assigned to start the service to authenticate against or the logged in user (which there might not be one)?

Thanks

A: 

You can change logged in users all you want, the service will keep running in the background under the account that it was initially started.

If the connection is set to using Integrated Security, then the account that the service is started under will be the one that is used.

Raj More
A: 

The service will connect using whatever user the service is running under (as visible in the service control manager).

Joe
A: 

Your service application is configured to always run as a particular user, for example "Service_User".

Even if user "Bob" logs in to start the service - all connections/files made by that service will appear to be from user "Service_User".

In your service application you make a JDBC connection to a database. If you specify Integrated Security in the connection string, it will log in to the database as "Service_User".

If you specify a Database username / password in your connection string, it will log into the database as that user.

That will happen regardless of the interactive login used to start it on the system.

Ron

Ron Savage
My service is started by a different user than the one that logs in. I was wondering about that situation
Javamann
I reworded it to try and make it clearer .. :-)
Ron Savage