[英]Spring Boot 2.2.2 Datasource URL not working for SQL Server 2019
I'm trying to doing a test development with Spring on SQL Server 2019, but all I get is the Datasource url attribute issue.我正在尝试在 SQL Server 2019 上使用 Spring 进行测试开发,但我得到的只是数据源 url 属性问题。
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
As for my yml configration I don't think I set something wrong至于我的 yml 配置,我认为我没有设置错误
spring:
datasource:
url: jdbc:sqlserver://localhost:1433;databaseName=yap_test
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
username: 'yap_user'
password: 'P@ssw0rd'
jpa:
hibernate:
ddl-auto: update
properties:
hibernate:
show_sql: false
format_sql: false
dialect: org.hibernate.dialect.SQLServer2012Dialect
use_nationalized_character_data: true
org:
hibernate:
envers:
audit_table_prefix: AUD_
audit_table_suffix: ''
revision_field_name: REVISION_ID
revision_type_field_name: REVISION_TYPE
store_data_at_delete: true
for the JDBC Driver i'm using mssql-jdbc-8.2.2.jre8对于 JDBC 驱动程序,我使用的是 mssql-jdbc-8.2.2.jre8
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>8.2.2.jre8</version>
</dependency>
I hope someone can help me figure out what's my configuration problem我希望有人能帮我弄清楚我的配置问题是什么
Everything looks fine.一切看起来都很好。 there is no problem with property file.属性文件没有问题。
1st of all try to check whether "mssql" jar is there or not in your local maven repository.首先,尝试检查本地 Maven 存储库中是否存在“mssql” jar。
if it's there then update your property file as below:--如果它在那里然后更新您的属性文件如下: -
spring.datasource.driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
In your Case it should be:--(yml file)在您的情况下,它应该是:--(yml 文件)
spring:
datasource:
driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
if it's not there:--如果它不在那里:--
solution :- give the mssql JAR path in the pom then run解决方案:- 在 pom 中给出 mssql JAR 路径然后运行
我实际上在 jar 重新打包期间添加了 exclude 任何 YML 文件,这就是为什么每次我尝试在本地运行它时都找不到 url 属性的原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.