码迷,mamicode.com
首页 > 数据库 > 详细

Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection;

时间:2020-01-07 21:27:26      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:技术   端口   解决   int   ase   could   ons   pac   query   

解决报错

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Tue Jan 07 21:06:43 CST 2020
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.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. ### The error may exist in com/imooc/mapper/StuMapper.java (best guess) ### The error may involve com.imooc.mapper.StuMapper.selectByPrimaryKey ### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.

检查数据库名 密码 端口无误后

修改包的版本

将 

   <version>5.1.41</version>

  改为

   <version>5.1.47</version>

重新运行项目 报错解决 可以调接口

{"id":1001,"name":"test","age":20}

技术图片

Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection;

标签:技术   端口   解决   int   ase   could   ons   pac   query   

原文地址:https://www.cnblogs.com/guangzhou11/p/12163768.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!