Hello,
I have a suite of integration tests running fine against a MySql 5 database schema of 117 tables.
There are 350 tests roughly.
Now, when I want to run this same suite of tests against an Oracle 10g XE database with the same schema of 117 tables, I get an exception telling me the number of connections has run out.
Now I wonder about what to do.Caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12516, TNS:listener could not find available handler with matching protocol stack
The Connection descriptor used by the client was:
stephane-ThinkPad-X61s:1521/xe
I don't feel like increasing the maximum number of allowed connections as it will simply delay the problem.
I could make sure the connection is closed after each integration test. This would mean not reusing allocated connections and therefore running slower, but at least it would run.
Or I could try to use some connection pooling and limit the number of connections in the pool, making sure Hibernate or the pooling mechanism does not use too many of them.
I have a Spring 3.1.3.RELEASE / Hibernate 3.6.9.Final environment with the following setup:
One DAO bean definition (there is one for each domain table):Code:<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="mappingDirectoryLocations"> <list> <value>classpath:com/thalasoft/learnintouch/core/domain</value> </list> </property> <property name="mappingResources"> <list> <value>com/thalasoft/learnintouch/core/domain/typedef.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop> <prop key="hibernate.connection.pool_size">0</prop> <prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> </props> </property> </bean> <!-- Setup the Spring transaction manager --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref local="sessionFactory" /> </property> </bean> <tx:annotation-driven /> <bean class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor" /> <!-- Translate dao exceptions into Spring exceptions --> <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
The data source bean definition:Code:<bean id="adminDao" class="com.thalasoft.learnintouch.core.dao.hibernate.AdminHibernateDao"> <property name="sessionFactory" ref="sessionFactory" /> </bean>
Thanks for any hint..Code:<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"> <value>${dataSource.driverClassName}</value> </property> <property name="url"> <value>${dataSource.url}</value> </property> <property name="username"> <value>${dataSource.username}</value> </property> <property name="password"> <value>${dataSource.password}</value> </property> </bean>


Reply With Quote
