sql-server - 使用 Windows 身份验证从 Spring Boot 应用程序连接到 MSSQL

标签 sql-server windows spring-boot unix

我目前正在使用以下属性从 Java spring boot 应用程序连接到远程 Mssql 服务器:

spring.datasource.url=jdbc:sqlserver://ip\\domain;databaseName=name
spring.datasource.username=abc
spring.datasource.password=def
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver

应用程序在 Windows 和 Unix 服务器上运行。我现在需要开始使用 Windows 身份验证而不是数据库凭据。这已经从 MSSQL 端配置和支持。在 Java spring boot 中,这是行不通的。我试图添加到 url: integratedSecurity=true 它说找不到 dll。我将 sqljdbc_auth.dll 添加到 java jre bin 文件夹,但它没有用。

最佳答案

我正在研究 MS SQL Server 2016、Hibernate 5.3.7.Final 和 Spring bot 2.2.0。对我来说,将这一行添加到属性中是可行的:(没有 jtds!)

spring.datasource.url=jdbc:servername;databasename=your_db_name;integratedSecurity=true

您可能还需要这些属性:

spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect

如果遇到“java.library.path 中没有 sqljdbc_auth”的问题。 你可以引用这个答案no sqljdbc_auth .

关于sql-server - 使用 Windows 身份验证从 Spring Boot 应用程序连接到 MSSQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52813704/

相关文章:

windows - 命令/PowerShell/SQL 服务器 : Is there any way to see how long a windows service has been running?

c# - 刷新窗口窗体,即使不是事件窗口

spring-boot - 如何在多模块项目中使用 Spring BOOT 和 Gradle 实现 AspectJ 编译时编织(编织所有模块)?

c++ - 在C++中获取Windows系统应用程序的文件大小

java - 在自动生成的实现中不使用按名称限定的映射结构中使用的方法

java - Spring boot (Maven) 运行时未找到外部 jar 类

sql - 将 1,000,000 行固定宽度文本导入 SQL Server 数据库的最快方法是什么?

sql - 批量插入不插入任何行

sql-server - 在 SSIS 中选择忽略失败时忽略的行会发生什么?

sql-server - 在更新语句中使用交叉应用