SpringBoot 使用JDBC连接Mysql数据库(idea)Failed to configure a DataSource: 'url' attribute is not specifi...

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2019-07-25 21:04:05.646 ERROR 18236 --- [          main] o.s.b.d.LoggingFailureAnalysisReporter  :

***************************

APPLICATION FAILED TO START

***************************

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

出现的错误页面如下


SpringBoot 使用JDBC连接Mysql数据库(idea)Failed to configure a DataSource: 'url' attribute is not specifi..._第1张图片
图一

其实就是你在搭建springboot框架的时候  运行前需要连接数据库  我在网上也看见了很多连接数据库的方法  但是很多都是不能解决这个问题的

首先我要在本地或者利用工具建好一个数据库(我用的是navicat建的)


SpringBoot 使用JDBC连接Mysql数据库(idea)Failed to configure a DataSource: 'url' attribute is not specifi..._第2张图片
图二

首先打开pom.xml文件 查看里面的依赖是否安装正确


SpringBoot 使用JDBC连接Mysql数据库(idea)Failed to configure a DataSource: 'url' attribute is not specifi..._第3张图片
图三

再打开resources文件下的application.properties   你打开里面可能是空的  这个时候就需要你来连接数据库


SpringBoot 使用JDBC连接Mysql数据库(idea)Failed to configure a DataSource: 'url' attribute is not specifi..._第4张图片
图四

这样就已经大功告成了


SpringBoot 使用JDBC连接Mysql数据库(idea)Failed to configure a DataSource: 'url' attribute is not specifi..._第5张图片
图五

我是一个小白 正在为了我爱的人和爱我的人而努力!

你可能感兴趣的:(SpringBoot 使用JDBC连接Mysql数据库(idea)Failed to configure a DataSource: 'url' attribute is not specifi...)