C3P0 Connection Problem
I am usi开发者_JS百科ng hibernate and cp30 for database operations and getting error:
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection
Here are my jdbc properties:
<property name="acquireIncrement" value="2"/>
<property name="initialPoolSize" value="6"/>
<property name="maxIdleTime" value="21600"/>
<property name="maxPoolSize" value="10"/>
<property name="maxStatements" value="0"/>
<property name="minPoolSize" value="2"/>
<property name="idleConnectionTestPeriod" value="10800"/>
<!--<property name="testConnectionOnCheckout" value="true" / >-->
<property name="preferredTestQuery" value="SELECT NOW()"/>
<property name="maxAdministrativeTaskTime" value="3590"/>
<property name="unreturnedConnectionTimeout" value="3595"/>
<property name="debugUnreturnedConnectionStackTraces" value="true"/>
and cp30:
<prop key="c3p0.acquire_increment">3</prop>
<prop key="c3p0.idle_test_period">300</prop>
<prop key="c3p0.max_size">15</prop>
<prop key="c3p0.max_statements">0</prop>
<prop key="c3p0.min_size">3</prop>
<prop key="c3p0.timeout">5000</prop>
Mysql is not giving me any connection right now. Is there any way to display the connection usage of mysql? And can i flush these bad connections? And the most important question is, what should i do to avoid this connection pool error?
Thanks in advance.
Datasource is
<!-- <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="${jdbc.driverClassName}" />
<property name="jdbcUrl" value="${jdbc.url}" />
<property name="user" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<!--<property name="connectionCustomizerClassName" value="org.xxx.webapp.common.persistence.WatchConnectionCustomizer"/>-->
<property name="maxStatements" value="500"/>
<property name="maxIdleTime" value="1800"/>
<property name="maxPoolSize" value="100"/>
<property name="minPoolSize" value="2"/>
<property name="initialPoolSize" value="2"/>
<property name="acquireIncrement" value="3"/>
<property name="idleConnectionTestPeriod" value="3000"/>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<value>org.fbis.models.Form21</value>
<value>org.fbis.models.GSCDetails</value>
<value>org.fbis.models.DigitalRegistraion</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServer2008Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
</bean>
Add hibernate-c3p0-4.2.1.Final.jar
精彩评论