springboot连接sqlserver2008r2 驱动版本问题。

<dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <version>8.2.2.jre8</version>
        </dependency>

版本比较常见的:8.4.1.jre8 : (这个版本查询数据没问题

最新的提示:9.2.1.jre8

 

用了上面二个版本,提示WARN  com.microsoft.sqlserver.jdbc.internals.TDS.Channel : TLSv1 was negotiated. Please update server and client to use TLSv1.2 at minimum.

意思:WARN com.microsoft.sqlserver.jdbc.internals。TDS。通道:已协商TLSv1。请更新服务器和客户端以至少使用TLSv1.2

版本有些高了。

 

目前连接的是sqlserver2008 r2的版本,比较老。用 8.2.2.jre8版本,warn消失(这个版本查询数据会报错)。

运行时曾报:

Reason: Failed to determine a suitable driver class:设置jre运行时版本解决。

 

 画框的版本已经不存在了。

以下是配制:

spring.datasource.url=jdbc:sqlserver://172.16.156.186:1433;databaseName=db;trustServerCertificate=true;useSSL=false
spring.datasource.username=sa
spring.datasource.password=123
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
# Specify the DBMS
spring.jpa.database = SQLSERVER
# Show or not log for each sql query
spring.jpa.show-sql = true
# Hibernate ddl auto (create, create-drop, update)
spring.jpa.hibernate.ddl-auto = update
# Naming strategy
#驼峰会原样生成
spring.jpa.hibernate.naming.physical-strategy = org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
# stripped before adding them to the entity manager
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.SQLServer2008Dialect
#启用jpa.open-in-view,改变session的生命周期,当web请求关闭时才结束session。
spring.jpa.open-in-view = true

 

posted @ 2024-04-29 20:25  jiduoduo  阅读(259)  评论(0编辑  收藏  举报