Springboot 2.0 无法访问 SQL 服务器数据库
Springboot 2.0 unable to access SQL Server Database
请帮助解决我在最新 Springboot (2.0.3.RELEASE) 上遇到的问题
尝试访问数据库时出现以下错误。在迁移到提到的 Springboot 和 Java 10.
版本之前,它一直在工作
开发环境:
-Spring 启动 2.0.3.RELEASE
-JDK / JRE 10 (jdk-10.0.1)
-IDE: Spring 工具套件 3.9.5.RELEASE
错误:
2018-07-19 20:24:37.524 ERROR 12532 --- [ restartedMain] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "SQL Server did not return a response. The connection has been closed. ClientConnectionId:33a45785-248c-4b57-ba29-f8802ddd8b25".
Caused by: java.io.IOException: SQL Server did not return a response. The connection has been closed. ClientConnectionId:33a45785-248c-4b57-ba29-f8802ddd8b25
org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta-data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "SQL Server did not return a response. The connection has been closed. ClientConnectionId:33a45785-248c-4b57-ba29-f8802ddd8b25".
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "SQL Server did not return a response. The connection has been closed. ClientConnectionId:33a45785-248c-4b57-ba29-f8802ddd8b25".
我关注了迁移 guide 但没有成功。我也试过在网上找到的不同配置,但没有解决这个问题。
发生这种情况是因为 Spring / Java 版本。
注意application.properties中的DataSource配置:
#CURRENT DATASOURCE CONFIG
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.url=jdbc:sqlserver://xxx.xxx.x.xx;databaseName=XXX
spring.datasource.hikari.username=user
spring.datasource.hikari.password=password
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.ddl-auto = none
spring.jpa.show-sql=true
#FOLLOWING CONFIG ARE JUST FOR REFERENCE. I TRIED THEM AS PER BLOGS
#spring.datasource.hikari.dataSourceClassName=com.microsoft.sqlserver.jdbc.SQLServerDataSource
#spring.datasource.url=jdbc:sqlserver://XXX.XXX.X.XX;databaseName=XXX
#spring.datasource.url=jdbc:sqlserver://XXX.XXX.X.XX:1433/XXX
#spring.datasource.type=
#spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSource
#spring.datasource.tomcat.max-active=1
#spring.datasource.username=wstapp
#spring.datasource.password=wstapp@test
#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDataSource
#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
#spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
#spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
本周我一直在寻找原因。有关正确配置的一些建议会有所帮助。
提前致谢。
这是一个 MSSQL-JDBC 问题。回答者:Nitin Vavdiya 为我指出了正确的方向。
我在这里找到了 "solution":https://github.com/Microsoft/mssql-jdbc/issues/719
我刚刚修改了 java.security 安装文件夹中的 文件并删除了值: 3DES_EDE_CBC 来自 jdk.tls.disabledAlgorithms 文件中:
计划Files\Java\"JRE Version"\lib\security
以下是对我有帮助的确切答案:
为了提高 SSL/TLS 连接的强度,已通过 jdk.tls.disabledAlgorithms 安全性 属性 在 JDK 的 SSL/TLS 连接中禁用 3DES 密码套件.
(http://www.oracle.com/technetwork/java/javase/8u171-relnotes-4308888.html)
更改 java.security 并从 jdk.certpath.disabledAlgorithms 中删除 3DES_EDE_CBC 后一切正常。我不确定需要在 SQLServer 配置中更改什么以禁用 3DES 作为 SSL 方案。
请帮助解决我在最新 Springboot (2.0.3.RELEASE) 上遇到的问题 尝试访问数据库时出现以下错误。在迁移到提到的 Springboot 和 Java 10.
版本之前,它一直在工作开发环境:
-Spring 启动 2.0.3.RELEASE
-JDK / JRE 10 (jdk-10.0.1)
-IDE: Spring 工具套件 3.9.5.RELEASE
错误:
2018-07-19 20:24:37.524 ERROR 12532 --- [ restartedMain] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "SQL Server did not return a response. The connection has been closed. ClientConnectionId:33a45785-248c-4b57-ba29-f8802ddd8b25".
Caused by: java.io.IOException: SQL Server did not return a response. The connection has been closed. ClientConnectionId:33a45785-248c-4b57-ba29-f8802ddd8b25
org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta-data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "SQL Server did not return a response. The connection has been closed. ClientConnectionId:33a45785-248c-4b57-ba29-f8802ddd8b25".
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "SQL Server did not return a response. The connection has been closed. ClientConnectionId:33a45785-248c-4b57-ba29-f8802ddd8b25".
我关注了迁移 guide 但没有成功。我也试过在网上找到的不同配置,但没有解决这个问题。
发生这种情况是因为 Spring / Java 版本。
注意application.properties中的DataSource配置:
#CURRENT DATASOURCE CONFIG
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.url=jdbc:sqlserver://xxx.xxx.x.xx;databaseName=XXX
spring.datasource.hikari.username=user
spring.datasource.hikari.password=password
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.ddl-auto = none
spring.jpa.show-sql=true
#FOLLOWING CONFIG ARE JUST FOR REFERENCE. I TRIED THEM AS PER BLOGS
#spring.datasource.hikari.dataSourceClassName=com.microsoft.sqlserver.jdbc.SQLServerDataSource
#spring.datasource.url=jdbc:sqlserver://XXX.XXX.X.XX;databaseName=XXX
#spring.datasource.url=jdbc:sqlserver://XXX.XXX.X.XX:1433/XXX
#spring.datasource.type=
#spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSource
#spring.datasource.tomcat.max-active=1
#spring.datasource.username=wstapp
#spring.datasource.password=wstapp@test
#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDataSource
#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
#spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
#spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
本周我一直在寻找原因。有关正确配置的一些建议会有所帮助。
提前致谢。
这是一个 MSSQL-JDBC 问题。回答者:Nitin Vavdiya 为我指出了正确的方向。
我在这里找到了 "solution":https://github.com/Microsoft/mssql-jdbc/issues/719
我刚刚修改了 java.security 安装文件夹中的 文件并删除了值: 3DES_EDE_CBC 来自 jdk.tls.disabledAlgorithms 文件中:
计划Files\Java\"JRE Version"\lib\security
以下是对我有帮助的确切答案:
为了提高 SSL/TLS 连接的强度,已通过 jdk.tls.disabledAlgorithms 安全性 属性 在 JDK 的 SSL/TLS 连接中禁用 3DES 密码套件. (http://www.oracle.com/technetwork/java/javase/8u171-relnotes-4308888.html)
更改 java.security 并从 jdk.certpath.disabledAlgorithms 中删除 3DES_EDE_CBC 后一切正常。我不确定需要在 SQLServer 配置中更改什么以禁用 3DES 作为 SSL 方案。