| Author |
DBCP could not obtain an idle db connection, pool exhausted
|
Justin Howard
Ranch Hand
Joined: Feb 19, 2009
Posts: 162
|
|
Hi All,
I am using Hibernate.
I am getting this exception in the logs and sometime it does not connect to the database.
Is there any free tool or software I could use to debug unclosed connections.
From the code I cannot find any unclosed connection. All the conections are colsed in the finally block.
How can I debug this?
This is in my hibernate.cfg.xml
This is in the context.xml
<Context debug="5" reloadable="true">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="jndi_ds_log" suffix=".txt" timestamp="true"/>
<Resource
name="jdbc/dsnFreelancerdb"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.commons.dbcp.BasicDataSourceFactory"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="db url"
username="user"
password="pass"
maxActive="100"
maxIdle="30"
maxWait="10000"
removeAbandoned="true" />
</Context>
Thanks
|
 |
Bosun Bello
Ranch Hand
Joined: Nov 06, 2000
Posts: 1506
|
|
|
What Happens if you bump up the pool size.
|
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
|
 |
Justin Howard
Ranch Hand
Joined: Feb 19, 2009
Posts: 162
|
|
Thanks for the reply.
When I increase the pool size to 200 it works fine.
But this is only QA. Around 3 people testing at a time.
In production I dont know how many people will hit the site at the same time.
Thanks
|
 |
Bosun Bello
Ranch Hand
Joined: Nov 06, 2000
Posts: 1506
|
|
|
I know you said you did already. However, I will suggest you check closely for connection leaks?
|
 |
Justin Howard
Ranch Hand
Joined: Feb 19, 2009
Posts: 162
|
|
Is there a tool to find the exact statement causing the problem.
I see this sometimes in the logs, but when I look at the code it has the closing portion in the finally block.
Is it a problem with the this code?
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16487
|
|
|
You'll need something that closes the Hibernate session. I see a method which would close the session if you called it, but I don't see any code which actually calls that method.
|
 |
Justin Howard
Ranch Hand
Joined: Feb 19, 2009
Posts: 162
|
|
Thanks for the reply.
I use it like this in the servlet or any other code
Also I changed the hibernate.cg.xml to this, cause I read in the documentation that hibernates connection pooling is rudimentary.
Does anyone have any idea what is the max size of hibernate.c3p0.max_size.
Thanks
|
 |
Bosun Bello
Ranch Hand
Joined: Nov 06, 2000
Posts: 1506
|
|
Looks like your code is closing the Hibernate session correctly.
If you are using hibernate 2, this has to be 0 <property name="hibernate.c3p0.min_size">0</property>
|
 |
Justin Howard
Ranch Hand
Joined: Feb 19, 2009
Posts: 162
|
|
Thanks,
what about the max size?
|
 |
 |
|
|
subject: DBCP could not obtain an idle db connection, pool exhausted
|
|
|