• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

DBCP initialSize param problem

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic