Re: jdbc pooling question

From: Kris Jurka <books(at)ejurka(dot)com>
To: "Marcus Andree S(dot) Magalhaes" <marcus(dot)magalhaes(at)vlinfo(dot)com(dot)br>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: jdbc pooling question
Date: 2004-01-11 22:14:01
Message-ID: Pine.LNX.4.33.0401111705510.5953-100000@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Sun, 11 Jan 2004, Marcus Andree S. Magalhaes wrote:

>
> Hi, guys.
>
> We're suffering (probably) a connection leak problem while
> using Jdbc2PoolingDataSource that comes with jdbc drivers
> for postgres 7.3.
>
> Recently, a freeze problem was detected and the debugging
> showed that we may have some leaks.
>
> Before digging deeply into the driver's source code, we decided
> to analyze our own java sources and found a couple places where
> the statements and the connections were closed, but not the
> resultset.
>
> The question is, in this configuration (connection & statement closed),
> there is any possibility of the connection isn't being properly closed
> by the pool and, therefore, being leaked?

Closing the connection will return the connection to the pool regardless
of the status of other related objects. The fact that closing the
statement and the connection doesn't completely close the ResultSet is a
bug, but not a terribly serious one. Adding a check for every single
method to check some kind of isClosed flag is tedious and wasteful.

Kris Jurka

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2004-01-11 22:40:25 Re: PreparedStatement parameters and mutable objects
Previous Message Kris Jurka 2004-01-11 21:56:36 Re: Connection Pool Timeout