No, that is not possible. Integrated security assumes that you have already been authenticated by Windows. To login with username + pass, SQL authentication is the way to go.
Connect to SQL server using jdbc with AD username and password
We want to In order to avoid SQL server accounts we want to use Active directory accounts in out java programs to connect to SQL server. We are not always able to use integrated security (e.g. different applications running on the same Wildfly instance should use different AD accounts). Is it possible to supply AD user name and password for the connection and what connection properties need to be set?
2 answers
Sort by: Most helpful
-
-
m 4,271 Reputation points
2020-08-28T03:09:11.917+00:00 Hi @Schuetze, Peter ,
Is it possible to supply AD user name and password for the connection and what connection properties need to be set?
No, it isn’t. As ErlandSommarskog’s reply, with configuring “integratedSecurity=true;” in connection string, JDBC will use the current Windows account on which the Java application runs to log in SQL Server. With the “user=MyUserName;password=*****;” in connection string, the "user" here is a valid SQL Server login rather than a Windows account. Please reference: http://technet.microsoft.com/en-us/library/ms378428.aspx
More information: Connecting a Java Program to SQL Server , Java connect MS SQL Server using windows authentication
BR,
Mia
If the reply is helped, please do “Accept Answer”.--Mia