spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.2k stars 40.69k forks source link

Springboot 15.21 cannot be linked to SQL Server 2012, is it a version incompatibility? #38629

Closed taidilixiang closed 11 months ago

taidilixiang commented 11 months ago

Java1.8, data source is alibaba.druid, spring boot 1.521 cannot connect to sqlserver2012, but can connect to sql2008. Is this version incompatible? It is normal to connect to SQL Server 2012 using the SQL client, but the Spring Boot startup error message indicates that the database connection cannot be made.

Start project error message:

2023-12-01 05:44:24.390 [Druid-ConnectionPool-Create-1412600960] ERROR com.alibaba.druid.pool.DruidDataSource - create connection SQLException, url: jdbc:sqlserver:/172.16.128.137:1433;databaseName=MQSF, errorCode 0, state null

java.sql.SQLException: connect error, url jdbc:sqlserver:/172.16.128.137:1433;databaseName=MQSF, driverClass com.microsoft.sqlserver.jdbc.SQLServerDriver

at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection([DruidAbstractDataSource.java:1627](https://link.zhihu.com/?target=http%3A//druidabstractdatasource.java%3A1627/))

at [com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run](https://link.zhihu.com/?target=http%3A//com.alibaba.druid.pool.druiddatasource%2524createconnectionthread.run/)([DruidDataSource.java:2468](https://link.zhihu.com/?target=http%3A//druiddatasource.java%3A2468/))`

Druid is 11.10, mssql-jdbc is 6.10, only the version of springboot is specified, and the versions of other packages are default.

I tried upgrading the version of mssql-jdbc to 9.2.1jre11,, but it seems that the version is not compatible with other packages. A higher version of mssql-jdbc may not be compatible with the version currently used by Springboot or Druid. To connect to sqserver2012, it seems necessary to use mssql-jdbc -9.2.1jre11. However, when Spring Boot version 1.5.21 matches mssql-jdbc -9.2.1jre11, it prompts' overlapping managed version 6.1.0.jre7 for mssql-jdbc ', but cannot connect to sqserver2012 using 6.1.0.jre7.

Excuse me, is it possible to connect to sqserver2012 in Spring Boot version 1.5.21 without upgrading to Spring Boot?

If the situation requires upgrading Springboot to connect to sql2012, what is the version of Springboot, Alibaba. druid, and mssql-jdbc iin order to connect to sqlserver2012?

If you can only upgrade to mssql-jdbc to 9.2.1jre11 to connect to SQL Server 2012, then Java cannot use version 1.8. Do Java versions also need to be upgraded?

Requesting everyone's help.

Here are some configuration information: application.yml

datasource:

url: jdbc:sqlserver:/172.16.128.137:1433;databaseName=MQSF

password: 1

username: sa

driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver

type: com.alibaba.druid.pool.DruidDataSource

pom.xml


<parent>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-parent</artifactId>

<version>1.5.21.RELEASE</version>

<relativePath/> <!-- lookup parent from repository -->

</parent>

<properties>

<java.version>1.8</java.version>

</properties>

<dependency>

<groupId>com.microsoft.sqlserver</groupId>

<artifactId>mssql-jdbc</artifactId>

<scope>runtime</scope>

</dependency>

<dependency>
scottfrederick commented 11 months ago

Thanks for getting in touch. I'm afraid we can't be of much help here. Spring Boot 1.5 has been out of support for many years, and we don't provide support for the Alibaba Druid datasource. This is a question that would be better suited to Stack Overflow.

If the situation requires upgrading Springboot to connect to sql2012, what is the version of Springboot, Alibaba. druid, and mssql-jdbc iin order to connect to sqlserver2012?

We can only answer about Spring Boot versions, but you'd need to upgrade to a currently support OSS version in order for us to spend any time investigating.