This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes Maximum Pool Connection using Hibernate.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Maximum Pool Connection using Hibernate.." Watch "Maximum Pool Connection using Hibernate.." New topic

Maximum Pool Connection using Hibernate..

Ankittt Shah

Joined: Aug 19, 2008
Posts: 6
Hi I am using following applicationContext.xml,

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
<property name="driverClassName"
<property name="url" value="jdbc racle:thin:@" />
<property name="username" value="qa" />
<property name="password" value="password" />
<property name="maxActive" value="80"/>
<property name="maxIdle" value="20"/>
<property name="maxWait" value="1000"/>
<property name="defaultAutoCommit" value="true"/>
<property name="removeAbandoned" value="true"/>
<property name="removeAbandonedTimeout" value="60"/>
<property name="logAbandoned" value="true"/>

<bean id="sessionFactory"
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">

<property name="hibernateProperties">
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
<prop key="hibernate.jdbc.batch_size">1000</prop>
<prop key="hibernate.cache.use_second_level_cache">false</prop>

It gives me following exception sometimes even i have 50 maximum active connections Could not get Connection for extracting meta data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
at org.springframework.orm.hibernate3.SessionFactoryUtils.newJdbcExceptionTranslator(
at org.springframework.orm.hibernate3.HibernateAccessor.getDefaultJdbcExceptionTranslator(
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(
at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(
at org.springframework.test.AbstractTransactionalSpringContextTests.onSetUp(
at org.springframework.test.AbstractSingleSpringContextTests.setUp(
at junit.framework.TestCase.runBare(
at org.springframework.test.ConditionalTestCase.runBare(
at junit.framework.TestResult$1.protect(
at junit.framework.TestResult.runProtected(

Can you recommend a better Datasource class, I am using "org.apache.commons.dbcp.BasicDataSourc" right now.
arulk pillai
Ranch Hand

Joined: May 31, 2007
Posts: 3274
Check on your database side to see how many connections are allowed.

500+ Java Interview Questions and Answers | Java job hunting know how & Java resumes
jQuery in Action, 2nd edition
subject: Maximum Pool Connection using Hibernate..