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

相关推荐
张子行的博客几秒前
SQL 调优实战:跨表排序性能提升之路
数据库·sql·oracle
ID_180079054731 分钟前
Python 实现京东商品详情 API 数据准确性校验(极简可直接用)
java·前端·python
贾斯汀玛尔斯1 分钟前
每天学一个算法--Aho–Corasick 自动机
java·linux·算法
LF男男11 分钟前
Action- C# 内置的委托类型
java·开发语言·c#
weixin_7042660517 分钟前
Spring Cloud Gateway
spring boot
练习时长一年21 分钟前
@NotEmpty注解引发的报错
java·服务器·前端
Irene199122 分钟前
数据发散(Data Spreading)详解(附:示例 数据发散最大值是笛卡尔乘积)
数据库
a95114164224 分钟前
c++如何解析二进制协议中的可选字段读取逻辑及其反序列化【详解】
jvm·数据库·python
weixin_5806140036 分钟前
golang如何实现时间格式化_golang时间格式化方法详解
jvm·数据库·python
西海天际蔚蓝36 分钟前
用AI写的一个包含web和小程序的个人简历
java