首页 > 学院 > 开发设计 > 正文

Hibernate+MySQL连接超时解决办法

2019-11-08 20:53:55
字体:
来源:转载
供稿:网友

Hibernate+MySQL连接超时解决办法。

hibernate.PRoperties中的配置如下:

#数据库驱动

hibernate.connection.driver_class = com.mysql.jdbc.Driver#数据库连接的URLhibernate.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
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表