views:

263

answers:

2

Duplicate of: http://stackoverflow.com/questions/881928/windows-authentication-trusted-connection-problem

I logged in the Windows Server(Machine 1) as "abc\user1 ". Windows Server machine is in abc domain. MSSQL Server is in the "abc" domain on Machine 1 and have mixed mode.authentication. It has account "abc\user1 " and "abc\user2 ". Both has role of sysadmin and serveradmin.

I logged in another machine(Machine 2) using "abc\user2 ". Same Domain. Run the ant which connect to MSSQL Server. URL is formed as follows.

jdbc:sqlserver://%DB_IP%:%DB_PORT%;SelectMethod=cursor;integratedSecurity=true;DatabaseName=dbname;

1) From Machine 2, If I use "abc\user2" credential for connection, then it works fine. since integratedSecurity=true.

2) From Machine 2, If I use "abc\user1" credential for connection, then it doesn't fine, since integratedSecurity=true and take System Credentials i.e "abc\user2". Even if I make integratedSecurity=false , then also it doesn't connect using "abc\user1"

What changes to URL I have make to work for "abc\user1" from Machine2 for connection. what properties to be added in url? OR Driver doesn't support to use another domain\User Credentials?

What need to set on MSSQL Server ??

Deepak

A: 

When you use integratedSecurity=true you don't have to specify any credentials, the user currently logged in the system will be used to authenticate against SQLserver.

If integratedSecurity=false. then you have to specify Sql server credentials(user and password) in the connString

Burnsys
I want to use MSSQLDomain\username credentails without integratedSecurity=true. I want to specify the domain\username for connection
When using Windows Authentication, you do not provide the login or password. It uses the current security context, meaning the person who is logged into the client machine.I don't want to use current security context. but which I provide "domain\username"
I don't think you can manually provide "Domain\username" they are automatically taken from the current logged user credentials
Burnsys
A: 

I think what Deepak wants to basically do is this:

Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;User ID=myDomain\myUsername;Password=myPassword;

However, that only works on CE devices.

On normal machines, it hits the Integrated part and uses the current credentials.

I think he wants to specify the domain user to use, instead of the currently logged in one.

Bo Flexson