SpringBoot连接SqlServer出现的问题

"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配置时出现了上方的问题

复制代码
spring:
  datasource:
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
    username: sa
    password: 123456
    url: jdbc:sqlserver://localhost:1433;databaseName=xxx;

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

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

相关推荐
是小蟹呀^6 小时前
Spring Security + JWT 面试题整理
java·jwt·springsecurity
聆听。。花开雨落7 小时前
mybatis的typeHandler 作用
数据库·mybatis
pxzsky8 小时前
PG17数据库安装中分分词插件:pg_jieba
数据库·postgresql·pg_jieba
spencer_tseng8 小时前
Redis + Nacos.bat
java·windows·dos
霸道流氓气质8 小时前
SpringBoot中通用工具类库(Utils)封装与使用实践
spring boot·后端·python
她说可以呀9 小时前
Redis哨兵
数据库·redis·bootstrap
troyzhxu9 小时前
列表查询的 GraphQL —— 一行代码终结你的 if-else 地狱!
java·springboot·graphql
霸道流氓气质9 小时前
KMS 密钥管理服务(Key Management Service)原理与实践
linux·服务器·数据库
kirs_ur9 小时前
CXL(Compute Express Link)— 内存扩展的未来
服务器·数据库·性能优化