0
votes

Duplicate of: Windows authentication trusted connection not working

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

2
This looks like a severfault.com question to me. - Copas

2 Answers

0
votes

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

0
votes

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.