hibernate与mysql连接超时的解决方法
2009-08-27 09:22
423 查看
用c3p0代替hibernate的连接池。c3p0.9.1.jar可从hibernate开源项目的lib下面找到,将其拷贝到web-inf/lib下面。在hibernate.cfg.xml配置文件中添加以下信息:
<property name="hibernate.cache.provider_class">
org.hibernate.cache.NoCacheProvider
</property>
<property name="hibernate.connection.provider_class">
org.hibernate.connection.C3P0ConnectionProvider
</property>
<property name="hibernate.c3p0.min_size">2</property>
<property name="hibernate.c3p0.timeout">(小于28800)</property>
<property name="hibernate.c3p0.max_statements">100</property>
<property name="hibernate.c3p0.idle_test_period">(小于28800)</property>
<property name="hibernate.c3p0.acquire_increment">2</property>
<property name="hibernate.c3p0.validate">false</property>
<property name="transaction.auto_close_session"></property>
<property name="hibernate.cache.provider_class">
org.hibernate.cache.NoCacheProvider
</property>
<property name="hibernate.connection.provider_class">
org.hibernate.connection.C3P0ConnectionProvider
</property>
<property name="hibernate.c3p0.min_size">2</property>
<property name="hibernate.c3p0.timeout">(小于28800)</property>
<property name="hibernate.c3p0.max_statements">100</property>
<property name="hibernate.c3p0.idle_test_period">(小于28800)</property>
<property name="hibernate.c3p0.acquire_increment">2</property>
<property name="hibernate.c3p0.validate">false</property>
<property name="transaction.auto_close_session"></property>
相关文章推荐
- hibernate+mysql 连接超时解决办法一,(网上找的)
- 【small项目】MySQL第二天早上第一次连接超时报错,解决方法com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
- mysql 连接超时解决方法
- mysql导入sql文件过大或连接超时的解决的方法
- MySQL第二天早上第一次连接超时报错,解决方法com.mysql.jdbc.exceptions.jdbc4.CommunicationsException
- Could not open Hibernate Session for transaction, 数据库连接超时解决方法
- MySQL第二天早上第一次连接超时报错,解决方法com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
- MySQL第二天早上第一次连接超时报错,解决方法com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
- Spring配置mysql连接池,连接超时解决方法
- MySQL第二天早上第一次连接超时报错,解决方法
- MySQL第二天早上第一次连接超时报错,解决方法com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
- Could not open Hibernate Session for transaction, 数据库连接超时解决方法
- Could not open Hibernate Session for transaction, 数据库连接超时解决方法
- Hibernate+MySQL连接超时解决办法
- Mysql连接超时的问题与解决方法
- linux下mysql 连接超时问题解决方法
- “超时时间已到。超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小。”问题的解决方法
- 使用MySQL和Hibernate时,出现java.lang.UnsupportedOperationException: Update queries only supported through HQL异常的解决方法
- 安装wdCP,无法连接mysql,解决方法
- DBDesigner 4连接MySQL 5问题解决方法