从数据库方面解决org.hibernate.exception.JDBCConnectionException:could not execute query
来源:互联网 发布:软件应用网络安全方案 编辑:程序博客网 时间:2024/06/05 07:53
世界很美好,感谢身边的一切.
---幸运皮
或者是报错:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communicationslink failure
网站部署好之后是可以好好运行的,但是,总是隔一段时间就会报org.hibernate.exception.JDBCConnectionException:could not executequery错误,在网上查了一下说是因为mysql数据库默认连接时间的问题,mysql默认连接时间是8个小时,所以,一般如果访问不多的网站来说,如果隔8个小时没有与数据库的连接,那就会报这个错误.
查了一些资料,有两大方向的解决方案吧:
一. 修改数据库设置
步骤一:进入数据库,看一下wait_timeout 的值:
Show global variables like ‘wait_timeout’;
28800秒就是8小时
步骤二:修改wait_timeout的值:
Set global wait_timeout=1814400;
看一下变了没有:
步骤三:最后重启tomcat.
这种方法有一个局限,那就是这样设置的话,总有一个时间限制.所以,最好使用下面的方法.
二. 使用数据库连接池.
这个方法还没有测试成功.但是这个应该是最好的解决方法.
- 从数据库方面解决org.hibernate.exception.JDBCConnectionException:could not execute query
- org.hibernate.exception.JDBCConnectionException: could not execute query
- org.hibernate.exception.JDBCConnectionException: could not execute query
- org.hibernate.exception.JDBCConnectionException: could not execute query
- org.hibernate.exception.JDBCConnectionException: could not execute query
- org.hibernate.exception.JDBCConnectionException: could not execute query
- org.hibernate.exception.JDBCConnectionException: could not execute query
- Oracle:org.hibernate.exception.JDBCConnectionException: could not execute query
- org.hibernate.exception.JDBCConnectionException: could not execute query
- org.hibernate.exception.JDBCConnectionException: could not execute query
- 用数据库连接池解决org.hibernate.exception.JDBCConnectionException:could not execute query
- 用数据库连接池解决org.hibernate.exception.JDBCConnectionException:could not execute query
- 用数据库连接池解决org.hibernate.exception.JDBCConnectionException:could not execute query
- 用数据库连接池解决org.hibernate.exception.JDBCConnectionException:could not execute query
- 用数据库连接池解决org.hibernate.exception.JDBCConnectionException:could not execute query
- 数据库长时间未操作自己断开org.hibernate.exception.JDBCConnectionException: could not execute query
- org.hibernate.exception.JDBCConnectionException: could not execute queryMySQL数据库连接超时
- org.hibernate.exception.SQLGrammarException: could not execute query
- 正则习点 --- 02
- Datasets for Data Mining
- new data sets
- C# SerialPort 串口通讯 通过计算机232来和外部设备通讯 DL/T1997 DL/T2007 通讯协议
- Visual Studio 成就系统大全,从今天起,做一个快乐的程序员,面朝成就,春暖花开!
- 从数据库方面解决org.hibernate.exception.JDBCConnectionException:could not execute query
- 开发带属性的标签
- 使用WITH提高查询效率
- 如何解决Install ncurses(ncurses-devel) and try again
- PostgreSQL表空间、模式、表、用户/角色之间的关系
- 死灰复燃的ThinkPad SL400 同机型与同问题可参考!也可帮忙排错!
- 2012/1/27 《C++ Primer Plus》第十二章:类和动态内存分配 学习笔记
- Set Access Control to File/Folder (ACL)
- usage打印出来为什么是1 呢呢呢???