Connect to SQL Server from Linux via JDBC using integratedSecurity (Windows authentication)?

前端 未结 4 1806
情话喂你
情话喂你 2020-12-15 22:30

Hey I am having trouble connecting to an SQL Server with Java code that is running on Linux.

If I set integratedSecurity=true, then the java code fails

4条回答
  •  死守一世寂寞
    2020-12-15 22:55

    You can't use integratedSecurity feature from Linux system, as it tied to windows system and uses your windows authentication. However, if you enable both SQL Server and Windows Authentication mode on your SQL Server, then you can create a login, map to corresponding database and use it in java from Linux.

    To enable SQL Server authentication:

    1. Right click on your server in management studio
    2. Properties
    3. Security
    4. Server authentication -> SQL Server and Windows Authentication mode

提交回复
热议问题