簡體   English   中英

錯誤消息“ com.mysql.cj.exceptions.WrongArgumentException:數據庫URL不能為null。”是什么意思?

[英]What does the error message “com.mysql.cj.exceptions.WrongArgumentException: The database URL cannot be null.” mean?

我正在使用MySQL數據庫進行Spring Boot項目。 如果我運行我的代碼,則出現WrongArgumentException ,它表示databaseURL cannot be null

application.properties:

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.jdbc-url=jdbc:mysql//localhost:3306/reserving?autoReconnect=true&useSSL=false
spring.datasource.username=root
spring.datasource.password=****

##Mapper Config##
mybatis.type-aliases-package=com.springboot.reserving
mybatis.mapper-locations=mapper/**/*.xml

spring.devtools.livereload.enabled =true

spring.freemarker.cache=false

錯誤信息:

java.sql.SQLNonTransientConnectionException: Cannot load connection class
 because of underlying exception: 
com.mysql.cj.exceptions.WrongArgumentException: The database URL cannot be null.

將屬性spring.datasource.jdbc-url更改為

spring.datasource.url=jdbc:mysql//localhost:3306/reserving?autoReconnect=true&useSSL=false

application-properties中沒有名為spring.datasource.jdbc-url 的屬性

更改

spring.datasource.jdbc-url

spring.datasource.url

spring.datasource.platform=mysql
spring.datasource.url=jdbc:mysql//localhost:3306/reserving?autoReconnect=true&useSSL=false 
spring.datasource.username=root
spring.datasource.password=****
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM