Cannot get a connection, pool exhausted解决办法
来源:互联网 发布:电脑直播变声软件 编辑:程序博客网 时间:2024/04/30 01:54
Cannot get a connection, pool exhausted解决办法
昨天看了下数据库连接池,有很多开源的连接池,为了方便就使用了tomcat中带的连接池,
开始找了几篇文章,都没有弄成功,tomcat图形管理界面创建连接池的也不好用,
后来在网上找了一篇tomcat5.5的配置文章,总算是解决了,
按照下面的例子试了下,刷新几次后就出现了
Cannot get a connection, pool exhausted
后来搜了一下,是连接池被耗尽,
没有关闭con,
解决办法有3个:
1重启tomcat服务器
2吧maxactive值调大
3在finally中关闭conn
Context initCtx=new InitialContext();
DataSource ds = (DataSource)initCtx.lookup("java:comp/env/jdbc/mysql");
c.getConnection();
out.println("从数据库查询数据:<br>");
Statement stmt=conn.createStatement();
ResultSet rs =stmt.executeQuery("select * from userinfo");
while(rs.next())
{
out.println(rs.getString(1));
out.println(rs.getString(2));
}
rs.close();
stmt.close();
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
if(conn!=null)
conn.close();
}
开始找了几篇文章,都没有弄成功,tomcat图形管理界面创建连接池的也不好用,
后来在网上找了一篇tomcat5.5的配置文章,总算是解决了,
按照下面的例子试了下,刷新几次后就出现了
Cannot get a connection, pool exhausted
后来搜了一下,是连接池被耗尽,
没有关闭con,
解决办法有3个:
1重启tomcat服务器
2吧maxactive值调大
3在finally中关闭conn
Context initCtx=new InitialContext();
DataSource ds = (DataSource)initCtx.lookup("java:comp/env/jdbc/mysql");
c.getConnection();
out.println("从数据库查询数据:<br>");
Statement stmt=conn.createStatement();
ResultSet rs =stmt.executeQuery("select * from userinfo");
while(rs.next())
{
out.println(rs.getString(1));
out.println(rs.getString(2));
}
rs.close();
stmt.close();
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
if(conn!=null)
conn.close();
}
- Cannot get a connection, pool exhausted解决办法
- Cannot get a connection, pool exhausted解决办法
- Cannot get a connection, pool exhausted解决办法
- Cannot get a connection, pool exhausted解决办法
- Cannot get a connection, pool exhausted
- [Tomcat]Cannot get a connection, pool exhausted
- Cannot get a connection, pool exhausted
- org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted和java.util.NoSuchElementException: Timeout wa
- hive问题Cannot get a connection, pool error Could not create a validated object 的解决办法
- tomcat 连接池泄露的问题:org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted, cause:java.util.NoSuchEleme
- Cannot get a connection, pool error Timeout waiting for idle object
- Cannot get a connection, pool error Timeout waiting for idle object
- org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting
- Cannot get a connection, pool error Timeout waiting for idle object
- org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool ex
- Cannot get a connection, pool error Timeout waiting for idle object解决方法
- Cannot get a connection, pool error Timeout waiting for idle object
- 如何解决Cannot get a connection, pool error Timeout waiting for idle object
- 暖床小妾
- 好友联盟GHOST XP SP2装机版
- 跳蚤算法完整类模块UltraFlea 2.0
- 巧凰戏凤
- 市北教师教育GHOST_XP_SP2 博采众长完美版
- Cannot get a connection, pool exhausted解决办法
- [LzmTW].[String]示例1
- 深雁论坛GhostXP_SP2 2008贺岁版
- 抢来的新娘
- 君须怜我
- 戏点鸳鸯
- 霏凡2007经典流行壁纸光盘 [贺岁版]
- 小鬼亮晶晶
- 如何正确的使用Java序列化技术(转)