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

相关推荐
程序猿追4 小时前
换场倒计时的暂停、重置与到点回调在 HarmonyOS 7 上怎么处理
运维·服务器·数据库·harmonyos
我要见SA姐15 小时前
用生活化类比当钥匙,一键打开 C++ 入门大门
java·开发语言·c++
@forever@6 小时前
【MySQL】数据库基础、架构与存储引擎详解
数据库·mysql·架构
LaughingZhu6 小时前
Product Hunt 热榜 2026-12-05:SoduWork、finerd split、Otari by Mozilla AI
java·人工智能·docker·chatgpt·容器
轩轩曲觞阁6 小时前
MySQL基础——数据类型
数据库·mysql
jnrjian7 小时前
Oracle 19C LogMiner 分析 Supplemental Log Groups
数据库·oracle
L-影7 小时前
HashMap详解-上篇
java·开发语言·spring·hashmap
爱笑的源码基地7 小时前
什么是智能预问诊系统?一套java版预问诊成品源码
java·源码·程序·预问诊·智能问诊·预问诊源码
她说..8 小时前
幂等问题分析
java·jvm·spring boot·spring·spring cloud·intellij-idea
摇滚侠8 小时前
《On Java 中文版 基础卷》阅读笔记 集合 24
java·开发语言·笔记