I hope someone can help with this problem, Ive got hibernate up and working but with connection pooling theres a problem. When I start the app the pool initializes. But if i recompile any classes without restarting tomcat the next time a servlet hits the db, it creates a new connection to db and doesnt reuse the available conn in the pool. This results in double the number of active connections to sql server. This also happens if i let the app sit idle for a few hours and come back to it and re-hit the servlet. Can anyone tell me why this is happening and how to avoid it.
db and app server are separate machines.
But when switch the app to use mysql, i can restart the database server without restarting the app server and it re-makes the pool on next connect. Works fine.
Anyone help?
env below.
Hibernate 2.1.8 running on tomcat 5.0.28
Mapping doc:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.datasource">java:comp/env/jdbc/PCMExchange</property>
<property name="show_sql">false</property>
<!--<property name="dialect">org.hibernate.dialect.SQLServerDialect</property> -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Mapping files -->
<mapping resource="Investor.hbm.xml"/>
<mapping resource="Offering.hbm.xml"/>
<mapping resource="Contact.hbm.xml"/>
<mapping resource="PrevYearRevenue.hbm.xml"/>
<mapping resource="Location.hbm.xml"/>
<mapping resource="PrevYearNetIncome.hbm.xml"/>
<mapping resource="PrevYearPreTaxIncome.hbm.xml"/>
<mapping resource="TotalAssets.hbm.xml"/>
<mapping resource="LongTermDebt.hbm.xml"/>
<mapping resource="ShortTermDebt.hbm.xml"/>
<mapping resource="StockholderEquity.hbm.xml"/>
<mapping resource="NumberShareHolders.hbm.xml"/>
<mapping resource="Sector.hbm.xml"/>
<mapping resource="Company.hbm.xml"/>
<mapping resource="Revenue.hbm.xml"/>
<mapping resource="SICCode.hbm.xml"/>
</session-factory>
</hibernate-configuration>
DB MS Sql server -> MS Sql Server driver with DBCP pooling
|