[Spring Boot]运行报错“Error querying database”
[Spring Boot]运行报错“Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection;”你好! 这是你第一次使用 Markdown编辑器 所展示的欢迎页。如果你想学习如何使用Markdown编辑器, 可
[Spring Boot]运行报错“Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection;”
(之前运行都是好好的,突然运行项目出现问题,报错的是数据库相关,正好顺便整理一下数据库)
具体报错如下:
There was an unexpected error (type=Internal Server Error, status=500).
nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. ### The error may exist in file [C:\Users\(项目路径)\UserMapper.xml] ### The error may involve com.house.mjxd.dao.UserMapper.login ### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
显然重点就是没连接上数据库,遂试图检查sqlyog连接数据库,发现连接也出了问题
解决此问题的方法是启动mysql服务,具体解决过程见这一篇,应该算踩坑集合了吧哈哈哈虽然很简单。
好吧,这篇没什么重要输出,就是说数据库连接问题报的错,解决数据库问题就运行正常了(项目没问题的前提下)
更多推荐
所有评论(0)