You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Peter Smith <sh...@lycos.co.uk> on 2003/09/06 06:08:49 UTC

[DBCP] Possible to explicitly close down a DataSource/Connection Pool?

We started having some database resource issues just after I introduced a DBCP-based class into our 
environment.  I think I am closing all connections/statements/resultsets appropriately, but I was wondering if 
Oracle just isn't cleaning-up invalid connections or something??

We're using the BasicDataSource object without JNDI, DBCP version 1.0.  I've tried BasicDataSource.close(), 
but it doesn't seem to do much -> I think this because as soon as I go to grab another connection from the 
BasicDataSource that I just closed, the connection gets returned almost instantly.  I was expecting it to take a 
couple of seconds to crank up a new connection like it seems to take when i first create the BasicDataSource 
and grab a connection.  What does it mean that it's so fast in returning a connection after the 
BasicDataSource is supposedly closed?  After closing, BasicDataSource reports 0 active and idle connections.

Thanks.

SIZE does matter - The UK's biggest *Free* Web based mail - 10 MB Free 
mail.lycos.co.uk



Re: [DBCP] Possible to explicitly close down a DataSource/Connection Pool?

Posted by Anton Tagunov <at...@mail.cnt.ru>.
Hello Peter!

Pass #1)

I've heard certain gossip recently on one of apache
lists that Oracle jdbc driver requires you to explicitly
cose any ResultSet then any Statement and then any Connection..

Or, maybe I'm totally out of the point here?.. Let me try again!

Pass #2)

Try the cvs version of DBCP and pool.
There has been a lot of fixing around it lately.

Pass #3)

But what is your problem exactly?
I see two problems in your mail, right?

3.1) You feel that some db-connection resources are leaking
3.2) Even when you explicitly close the pool it acts as if it
     is open?

Please confirm if you have both 3.1 and 3.2.
Please confirm if you still have 3.1 and 3.2 with cvs DBCP.

3.2 looks like a bug - after all, close() is close() and
the datasource should be out of operation after it, shouldn't it?
But this is not your primary problem, as I guess, right?

BTW, the 2 second delay on first connection retrieval might be
the time needed to load the driver into memory. The connection
itself on a LAN may be quite fast.

So, let's try to see if I have understood you correctly :-)

Saturday, September 6, 2003, 8:08:49 AM, you wrote:

PS> We started having some database resource issues just after I introduced a DBCP-based class into our 
PS> environment.  I think I am closing all connections/statements/resultsets appropriately, but I was wondering if 
PS> Oracle just isn't cleaning-up invalid connections or something??

PS> We're using the BasicDataSource object without JNDI, DBCP version 1.0.  I've tried BasicDataSource.close(), 
PS> but it doesn't seem to do much -> I think this because as soon as I go to grab another connection from the 
PS> BasicDataSource that I just closed, the connection gets returned almost instantly.  I was expecting it to take a 
PS> couple of seconds to crank up a new connection like it seems to take when i first create the BasicDataSource 
PS> and grab a connection.  What does it mean that it's so fast in returning a connection after the 
PS> BasicDataSource is supposedly closed?  After closing, BasicDataSource reports 0 active and idle connections.

PS> Thanks.

PS> SIZE does matter - The UK's biggest *Free* Web based mail - 10 MB Free 
PS> mail.lycos.co.uk





-- 
Best regards,
 Anton                            mailto:atagunov@mail.cnt.ru


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [DBCP] Possible to explicitly close down a DataSource/Connection Pool?

Posted by Dirk Verbeeck <di...@pandora.be>.
Normally all connections should be closed, on an oracle level as well.
If you doubth then check the oracle session (select * from v$session)
or do a netstat on a command promp and count the connection to the 
database server.

Dirk

Peter Smith wrote:

>We started having some database resource issues just after I introduced a DBCP-based class into our 
>environment.  I think I am closing all connections/statements/resultsets appropriately, but I was wondering if 
>Oracle just isn't cleaning-up invalid connections or something??
>
>We're using the BasicDataSource object without JNDI, DBCP version 1.0.  I've tried BasicDataSource.close(), 
>but it doesn't seem to do much -> I think this because as soon as I go to grab another connection from the 
>BasicDataSource that I just closed, the connection gets returned almost instantly.  I was expecting it to take a 
>couple of seconds to crank up a new connection like it seems to take when i first create the BasicDataSource 
>and grab a connection.  What does it mean that it's so fast in returning a connection after the 
>BasicDataSource is supposedly closed?  After closing, BasicDataSource reports 0 active and idle connections.
>
>Thanks.
>  
>




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org