当前位置:   article > 正文

SpringBoot连接SqlServer出现的问题_“encrypt”属性设置为“true”且 “trustservercertificate”属性设置

“encrypt”属性设置为“true”且 “trustservercertificate”属性设置为“false

Encrypt”属性设置为“true”且 “trustServerCertificate”属性设置为“false”,但驱动程序无法使用安全套接字层 (SSL) 加密与 SQL Server 建立安全连接:错误:PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target。

通过yml配置时出现了上方的问题

  1. spring:
  2. datasource:
  3. driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
  4. username: sa
  5. password: 123456
  6. url: jdbc:sqlserver://localhost:1433;databaseName=xxx;

这时候注意你的sql语句不能写错了,不然也会报错

在数据库名后面 ;trustServerCertificate=true 加上这个就可以了

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/418900
推荐阅读
相关标签
  

闽ICP备14008679号