java spring:通过集成身份验证为sql server配置属性
我在java spring中有一个简单的应用程序,但我无法配置与本地sql server数据库的连接,该数据库与windows集成了身份验证
我的财产
spring.datasource.url=jdbc:sqlserver://localhost;databaseName=mydatabase
spring.integratedSecurity=true
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.testOnBorrow=false
spring.datasource.validationQuery=SELECT 1
我的数据库配置
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.
谢谢
# 1 楼答案
您需要在
spring.datasource.url
中添加integratedSecurity=true
在你的应用程序中是这样的。房产就行了
spring.datasource.url=jdbc:sqlserver://localhost;databaseName=mydatabase;integratedSecurity=true
有关更多信息,请参阅以下链接:
https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql/authentication-in-sql-server
https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/connection-string-syntax