Spring 2.5.6
Hibernate3
c3po 0.9.1
postgres 8.2
my postgres connections remain idle, even when I set the
Code:
<property name="maxIdleTime" value="5"/>
in my spring-config.xml file.
Is there any reason why hibernate/spring/c3po will not remove idle connections in postgres?
The only way of removing them at the moment is using:
Code:
<property name="unreturnedConnectionTimeout" value="10"/>
It works but it's stupendously bad way of doing it I think.
spring-config.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
<bean id="datasourceGD"
class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="org.postgresql.Driver" />
<property name="jdbcUrl" value="jdbc:postgresql://localhost/digital" />
<property name="user" value="digital" />
<property name="password" value="d1gital" />
<property name="maxPoolSize" value="50"/>
<property name="minPoolSize" value="1"/>
<property name="maxIdleTime" value="5"/>
<!--<property name="maxIdleTimeExcessConnections" value="3"/>-->
<!-- <property name="testConnectionOnCheckin" value="true"/>-->
<!--<property name="unreturnedConnectionTimeout" value="10"/>-->
<!--<property name="debugUnreturnedConnectionStackTraces" value="true"/>-->
<!--<property name="automaticTestTable" value="true"/>-->
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="datasourceGD" />
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect
</prop>
<prop key="hibernate.jdbc.batch_size">0</prop>
<!-- second level cache -->
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider
</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.use_minimal_puts">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<!-- <prop key="hibernate.max_fetch_depth">100</prop> -->
<!-- logging properties -->
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">false</prop>
<prop key="hibernate.use_sql_comments">false</prop>
</props>
</property>
</bean>
</beans>
Cheers
Euan