This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths 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 Head First Android this week in the Android 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: 3359
Check on your database side to see how many connections are allowed.

[] | [Java job hunting know how] | [Java resumes]
It is sorta covered in the JavaRanch Style Guide.
subject: Maximum Pool Connection using Hibernate..
It's not a secret anymore!