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

相关推荐
xxxibolva1 小时前
SQL 学习
数据库·sql·学习
孪生质数-1 小时前
MySQL主从延迟根因诊断法
数据库·mysql
bLEd RING1 小时前
Redis 设置密码无效问题解决
数据库·redis·缓存
WiChP2 小时前
【V0.1B5】从零开始的2D游戏引擎开发之路
java·服务器·数据库
cch89182 小时前
汇编与Java:底层与高层的编程对决
java·开发语言·汇编
75115893 小时前
笔记:postgresql如何下载驱动并安装?
数据库·postgresql
荒川之神3 小时前
拉链表概念与基本设计
java·开发语言·数据库
Highcharts.js3 小时前
适合报表系统的可视化图表|Highcharts支持直接导出PNG和PDF
javascript·数据库·react.js·pdf
cch89183 小时前
汇编与Go:底层到高层的编程差异
java·汇编·golang