wood burning stoves 2.0*
The moose likes Tomcat and the fly likes DBCP initialSize param problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "DBCP initialSize param problem" Watch "DBCP initialSize param problem" New topic
Author

DBCP initialSize param problem

Haroldo Nascimento
Ranch Hand

Joined: Aug 14, 2003
Posts: 79
Hi
I am using tag "initialSize" in the server.xml to configurated the number of connection opened when the container is statred.
...
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>initialsize</name>
<value>20</value>
</parameter>
<parameter>
<name>validationQuery</name>
<value>select * from DUAL</value>
</parameter>
...

The site http://jakarta.apache.org/commons/dbcp/configuration.html say:
initialSize : "The initial number of connections that are created when the pool is started."

The problem is that I dont see the 20 conncetion opened in the TOAD application when I start the container/pool connection. This tag configuration is to define the number of conncetion opened ??


Thanks
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

initialSize (capital 'S').


another thought is to only set maxActive and leave initialSize at zero (the default). That way, it only creates the connections when needed.

Something else... does 'SELECT * FROM DUAL' actually return a row? DUAL is a per-query virtual table, right? So on any given query, it contains nothing? You'd need 'SELECT 1 FROM DUAL', wouldn't you? But then again, I'm not an Oracle DBA.
[ September 09, 2004: Message edited by: Mike Curwen ]
Haroldo Nascimento
Ranch Hand

Joined: Aug 14, 2003
Posts: 79
Ok Mike

Its works now. Now I can see the n connections opened with the DB. where n is define in the tag initialSize in the server.xml.

The big problem that saw is that: when the application web is deployed, the the container tomcat (DBCP) create more n connections with DB. The DBCP dont kill the n connection opened before (I need close the tomcat to kill the connections).

There is any form of kill the connection without close and start the container (DBCP) ?

thanks
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

the point of configuring DBCP in Tomcat is to have a pool of database connections that is "container managed". So they'd remain open until the container goes away, at which point, they are closed.

There's a way to configure DBCP to close idle connections. It's in the same docs you've previously looked in. So what you'd see is a certain amount of connections opened (either when the container starts, or as necessary), and then over time, if you've set the DBCP to reclaim idle connections, they will be closed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DBCP initialSize param problem
 
Similar Threads
Connection Pool: connecting in memory
Connection pooling using Tomcat
Have Been Struggling for More Than a Week. Tomcat Connection Pool Configuration Prob
Commons DBCP with socketTimeout JTDS driver
connection pooling with Tomcat 4.0