您的位置:首页 > 数据库 > MySQL

Hibernate+MySQL连接超时解决办法

2017-02-08 22:14 232 查看
Hibernate+MySQL连接超时解决办法。

hibernate.properties中的配置如下:

#数据库驱动

hibernate.connection.driver_class = com.mysql.jdbc.Driver

#数据库连接的URL

hibernate.connection.url = jdbc:mysql://localhost:3306/db_123456

#用户名

hibernate.connection.username = root

#密码

hibernate.connection.password =root

#是否显示SQL语句

hibernate.show_sql=true

#Hibernate方言

hibernate.dialect =org.hibernate.dialect.MySQLDialect

#最小连接数

hibernate.c3p0.min_size=5

#最大连接数

hibernate.c3p0.max_size=20

#获得连接的超时时间,如果超过这个时间,会抛出异常,单位毫秒

hibernate.c3p0.timeout=1800

#最大的PreparedStatement的数量

hibernate.c3p0.max_statements=50
#设为true那么在取得连接的同时将校验连接的有效性

hibernate.c3p0.testConnectionOnCheckout=true
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: