IEDA:Failed to configure a DataSource: ‘url‘ attribute is not specified 和报错500No database selected问题

1.Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded

今天用IDEA搞springboot项目,一直报错Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded,搜了半天来回改,还是一直报错,直到我猛然看到一个视频弹幕说yml配置时:后面要放一个空格!!!我意识到自己好像没放,一检查我所有句子都没有空格,我哭死,改了之后成功解决。

2. 运行报错500:ERROR 14232 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: 

Error querying database.  Cause: java.sql.SQLException: No database selected

### The error may exist in com/example/demo/mapper/UserMapper.java (best guess) ### The error may involve defaultParameterMap

### The error occurred while setting parameters

### SQL: SELECT  id,no,name,password,sex,phone,role_id,isvalid  FROM user

### Cause: java.sql.SQLException: No database selected ; uncategorized SQLException; SQL state [3D000]; error code [1046]; No database selected; nested exception is java.sql.

SQLException: No database selected] with root cause

我又搜了半天,看到一个博主说要在yml的url路径里写上数据库名!!!我写上之后成功解决问题。如下图test是数据库名。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值