日期:2014-05-16  浏览次数:20492 次

不会导致数据库自动断开的连接方法
hibernate连接Oracle 数据库 一段时间后连接不上了,报异常,就换成以下连接方式,当然要导入C3p0的包

<!-- 数据库连接 -->
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.password">******</property>
<property name="hibernate.connection.SetBigStringTryClob">true</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@**.**.**.**:1521:orcl2</property>
<property name="hibernate.connection.username">***</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="hibernate.c3p0.min_size">1</property>
<property name="hibernate.c3p0.max_size">5</property>
<property name="hibernate.c3p0.timeout">2500</property>
<property name="hibernate.c3p0.max_statements">50</property>