Hibernate+Tomcat的pool exhausted问题
系统运行一段时间之后出现Cannot get a connection,pool exhausted
数据源配置
<Resource name="jdbc/test" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="test" password="test" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
url="jdbc:microsoft:sqlserver://localhost:1433;databasename=Test"/>
部分操作代码
public void delete(Object o) throws Exception {
Session session = sessionFactory.openSession();
Transaction t = session.beginTransaction();
try {
session.delete(o);
t.commit();
} catch (Exception ex) {
t.rollback();
throw ex;
} finally {
session.close();
}
}
运行20-30分钟就出现这个问题了,真郁闷