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> ...
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 ]
Joined: Aug 14, 2003
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) ?
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.