You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jose María Zaragoza <de...@gmail.com> on 2013/09/09 20:56:01 UTC

Release a database connection from pool

Hello:

I've got a simple question.
I'm using Tomcat 6 & DBCP library ( bit I've got the same question
with Tomcat JDBC pool )


My question is:

when DBCP wants to release a database connection from the pool ( for
example , if it is idle for more than minEvictableIdleTimeMillis )

does it just close the TCP socket connection ( FIN packet )?
If it does, is it enough for remote database server knows that it has
to release its resources ?

Or does it do anything more by using propietary driver's commands? I
asking me if ( some ) database servers need a special command to
finish a connection/session ?


Thanks and regards

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Release a database connection from pool

Posted by Daniel Mikusa <dm...@gopivotal.com>.
On Sep 9, 2013, at 4:10 PM, Jose María Zaragoza <de...@gmail.com> wrote:

> 2013/9/9 Daniel Mikusa <dm...@gopivotal.com>:
>> On Sep 9, 2013, at 2:56 PM, Jose María Zaragoza <de...@gmail.com> wrote:
>>> 
>>> Or does it do anything more by using propietary driver's commands? I
>>> asking me if ( some ) database servers need a special command to
>>> finish a connection/session ?
>> 
>> Not sure what you mean here.  Can you elaborate?
> 
> Thanks.
> 
> I would like to know if closing the underlying TCP connection is
> enough to notify to database server that it has to release any
> resource reserved for that connection.
> 
> Or some database servers have got a propietary way ( a protocol , i
> mean ) to finish connections ( known by propietary driver )
> Of course, finally, the TCP connection is closed but I wonder if there
> is any message interchange between driver and database server to
> finish the connection.

Hard to say.  I suppose you could setup Wireshark and monitor the traffic between your Tomcat instance and your database to see what happens. That might give you some idea as to what' going on.

> Really my question is if an intermediate firewall finishes the
> connection , the database server realizes that it must to release its
> resources

Again, hard to say because you're asking about the behavior of the database.  You'd be better off asking the mailing list for the DB (if it's OSS) or support (if it's proprietary).

Dan

> 
> I don't know if I explained better ...
> 
> 
> Regards
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Release a database connection from pool

Posted by Jose María Zaragoza <de...@gmail.com>.
2013/9/9 Daniel Mikusa <dm...@gopivotal.com>:
> On Sep 9, 2013, at 2:56 PM, Jose María Zaragoza <de...@gmail.com> wrote:
>>
>> Or does it do anything more by using propietary driver's commands? I
>> asking me if ( some ) database servers need a special command to
>> finish a connection/session ?
>
> Not sure what you mean here.  Can you elaborate?

Thanks.

I would like to know if closing the underlying TCP connection is
enough to notify to database server that it has to release any
resource reserved for that connection.

Or some database servers have got a propietary way ( a protocol , i
mean ) to finish connections ( known by propietary driver )
Of course, finally, the TCP connection is closed but I wonder if there
is any message interchange between driver and database server to
finish the connection.

Really my question is if an intermediate firewall finishes the
connection , the database server realizes that it must to release its
resources

I don't know if I explained better ...


Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Release a database connection from pool

Posted by Daniel Mikusa <dm...@gopivotal.com>.
On Sep 9, 2013, at 2:56 PM, Jose María Zaragoza <de...@gmail.com> wrote:

> Hello:
> 
> I've got a simple question.
> I'm using Tomcat 6 & DBCP library ( bit I've got the same question
> with Tomcat JDBC pool )
> 
> 
> My question is:
> 
> when DBCP wants to release a database connection from the pool ( for
> example , if it is idle for more than minEvictableIdleTimeMillis )
> 
> does it just close the TCP socket connection ( FIN packet )?
> If it does, is it enough for remote database server knows that it has
> to release its resources ?

I can't speak for DBCP, but Tomcat's jdbc-pool will call Connection.close() when appropriate.  I would guess that DBCP does the same thing.

> 
> Or does it do anything more by using propietary driver's commands? I
> asking me if ( some ) database servers need a special command to
> finish a connection/session ?

Not sure what you mean here.  Can you elaborate?

Dan


> 
> 
> Thanks and regards
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Release a database connection from pool

Posted by Jose María Zaragoza <de...@gmail.com>.
2013/9/10 Christopher Schultz <ch...@christopherschultz.net>

> It can't: not all JDBC drivers use TCP/IP, so the only thing the DBCP
> can do is call Connection.close and hope the driver does something
> intelligent.

It makes sense


>
> That's up to the database server. I can't imagine a db server that
> would not know what to do under these circumstances.

OK. Thanks Christopher

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Release a database connection from pool

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jose,

On 9/9/13 2:56 PM, Jose María Zaragoza wrote:
> Hello:
> 
> I've got a simple question. I'm using Tomcat 6 & DBCP library ( bit
> I've got the same question with Tomcat JDBC pool )
> 
> 
> My question is:
> 
> when DBCP wants to release a database connection from the pool (
> for example , if it is idle for more than
> minEvictableIdleTimeMillis )
> 
> does it just close the TCP socket connection ( FIN packet )?

It can't: not all JDBC drivers use TCP/IP, so the only thing the DBCP
can do is call Connection.close and hope the driver does something
intelligent.

> If it does, is it enough for remote database server knows that it
> has to release its resources ?

That's up to the database server. I can't imagine a db server that
would not know what to do under these circumstances.

> Or does it do anything more by using propietary driver's commands?
> I asking me if ( some ) database servers need a special command to 
> finish a connection/session ?

Servers need to be tolerant of clients disappearing without warning.
Any sane database would rollback any in-progress transactions and, of
course, release any server-side resources necessary to support that
client.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJSLyDWAAoJEBzwKT+lPKRYbt0QAIwX+FltnxXCiYR39HqGHPop
HUbFx36HykgODEhwWPaPUqKKs3+7TZO0bOSxGeXIyehN/zwZczswArSGKlWGvlVo
pOWLpp5qgqycL0CgqGG0tnmz369PGNz3FdXHMiZNGIoEiDzhgcz8//6tDKVZoWYK
6m8YrzEirdbTtr+KteIQUVDop1wn1jPdYZ0Nz2GBRoaeYLvjs6kqtbtt64xks4zn
8Fyp5lvnZHtBcLFZAeOaMBx9KdU1QN+ihDKm/ngEi1iPe94VoQxMmi8nEg5T69Ql
rToR7cIOexDbrzoOGTvMjs3LqWVcwD8wQYTh2xJ7SruvG2EMaJjPVswaCK49sTe2
G50EhuihctfJtlxqYP1leGeNYTBrGLSlNsUCKROYZ8POAuMg+pPJoD+geK0fCLIt
ffiET0aLmwT5pGVdNcEmcNnDRAjTnErmc+CNP/p+KhBlwBf3/t1XyqFWRunzN24a
Q97ycxrtueuMOnGxSDeZ7UfPXn644IKi3VEgiKXrlANz51qAXn9eR21sl7KnJLMR
QUZ+dKJWKdMta6rimkQ25zdiyXzlZrds9S39oK4vMhDIUo85BTApU08a1SV8R76t
p41u7M3SxaJzmJELH+/svbb9sSb6NlyzqdYO6QuclBRyqXHGulOQfvGMeX5e7Xig
y9R/xtkAIttxDFTvI6cp
=BAiZ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org