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 加上这个就可以了

相关推荐
ps酷教程28 分钟前
Jackson 解决没有无参构造函数的反序列化问题
java
NiceCloud喜云33 分钟前
Opus 4.8 的 Effort Control 怎么选:Low 到 Max 五档策略
android·java·大数据·前端·c++·python·spring
ccddsdsdfsdf1 小时前
DBeaver怎么链接mongoDB
数据库·mongodb
_日拱一卒2 小时前
LeetCode:994腐烂的橘子
java·数据结构·算法·leetcode·深度优先
隔窗听雨眠2 小时前
Nginx网关响应慢排查手记
java·服务器·nginx
丷丩2 小时前
Postgresql基础实践教程(十一)各种Join
数据库·postgresql·join
星夜夏空992 小时前
FreeRTOS学习(4)——内存映射
数据库·学习·mongodb
智慧物业老杨2 小时前
智慧物业合同周期管理系统:从风险预警到智能交接的全流程数智化落地方案
java·人工智能·python
源码宝2 小时前
MES系统源码:Java8 + SpringBoot2.7 + MySQL8 + Redis,后端源码清爽易扩展
java·后端·源码·springboot·mes系统·源码二开·mes源码
TheRouter3 小时前
AI Agent 记忆体系建设实战:短期、长期与工作记忆的工程实现
数据库·人工智能·oracle