dcsimg
Got JDBC Connection pool exhausted message
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Gerard_Martinelli
Posted On:   Saturday, June 25, 2005 04:54 AM

Sometimes, I got the "Connection pool exhausted" message when I want to get a new connection to MYSQL Database. After checking and rechecking my code, I have not found any part where I could leave my servlet without closing the connection (I always use a finally clause). However, I'm wondering what is happening in the case below : public class Test1 extends HttpServlet { private javax.sql.DataSource ds=null; protected void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { try { con = ds.getConnection(); MyBean ad = new MyBean(con); } catch (Exception ex) { .....}    More>>


Sometimes, I got the "Connection pool exhausted" message when I want to get a new connection to MYSQL Database.

After checking and rechecking my code, I have not found any part where I could leave my servlet without closing the connection (I always use a finally clause).

However, I'm wondering what is happening in the case below :

			
public class Test1 extends HttpServlet
{
private javax.sql.DataSource ds=null;

protected void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException
{
try
{
con = ds.getConnection();
MyBean ad = new MyBean(con);
}
catch (Exception ex) { .....}
finally
{
if (con != null)
{
try {con.close();}
catch (SQLException e) {}
}
}
}
}


What is going on if the bean "MyBean" does not close Statements and ResultSets ? Is the con.close() accepted and processed ?

Is there any way to get the number of connections available (just for tracing purpose) ?

Thanks

Gerard    <<Less

Re: Got JDBC Connection pool exhausted message

Posted By:   vinay_salehithal  
Posted On:   Monday, June 27, 2005 04:08 PM

Have you ruled out the possibility of number of simulatenous http requests at any instant being greater than the max number of connections available in the pool? In that case all connections would have been occuupied and need for additional connection may generate the "pool exhausted" error.
About | Sitemap | Contact