You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Tony Seebregts <to...@cibecs.com> on 2005/08/15 12:59:36 UTC

PooledConnection being closed

Hi,

I'm writing a connection pool manager using the 
EmbeddedConnectionPoolDatasource class. The requesting object gets the 
Connection object from a PooledConnection  getConnection() , executes a 
SQL statement and then closes the Connection.

This correctly invokes the ConnectionEventListener.close() method - 
which simply marks the pooled connection as available for reused. But 
when I try to resuse the connection originally supplied by the 
PooledConnection getConnection() method the connection is closed. 
Calling getConnection returns me a new Connection which is (AFAIK) not 
the idea.

Any ideas ?

regards

Tony Seebregts



Re: PooledConnection being closed

Posted by TomohitoNakayama <to...@basil.ocn.ne.jp>.
Hello, David .

> Hi, Tomohito.  I think I misunderstood this email as a request to 
> *backport* DERBY-412 to 10.1, but I see it's  request to *forward-port* 
> it into the trunk
> 
> http://mail-archives.apache.org/mod_mbox/db-derby-dev/200507.mbox/%3c007201c58e14$77a1cdf0$0800a8c0@Arkat%3e

I understand your misunderstanding.
My mail seems to be misleading ..... Sorry.
Explaining myself, I was not sure which branch you are working for at first.


> I made my changes to DERBY-412 into the trunk (same as 10.2).    So I 
> don't think DERBY-412 needs to be forward-ported into the trunk, right?

Yes. I have confirmed it in next mail.
http://mail-archives.apache.org/mod_mbox/db-derby-dev/200507.mbox/%3c000d01c58f7e$da676e70$0800a8c0@Arkat%3e
And I have commited the patch to trunk.

Best regards.

/*

         Tomohito Nakayama
         tomonaka@basil.ocn.ne.jp
         tomohito@rose.zero.ad.jp
         tmnk@apache.org

         Naka
         http://www5.ocn.ne.jp/~tomohito/TopPage.html

*/
----- Original Message ----- 
From: "David Van Couvering" <Da...@Sun.COM>
To: "Derby Discussion" <de...@db.apache.org>
Sent: Tuesday, August 16, 2005 7:48 AM
Subject: Re: PooledConnection being closed


> Hi, Tomohito.  I think I misunderstood this email as a request to 
> *backport* DERBY-412 to 10.1, but I see it's  request to *forward-port* 
> it into the trunk
> 
> http://mail-archives.apache.org/mod_mbox/db-derby-dev/200507.mbox/%3c007201c58e14$77a1cdf0$0800a8c0@Arkat%3e
> 
> I made my changes to DERBY-412 into the trunk (same as 10.2).    So I 
> don't think DERBY-412 needs to be forward-ported into the trunk, right?
> 
> I thought perhaps it may be worthwhile to backport DERBY-412 (along with 
> DERBY-243) into 10.1.  But you are right, this is an enhancement, and 
> thus probably not the right thing to put into a maintenance branch.
> 
> David
> 
> TomohitoNakayama wrote:
> 
>> Hello.
>>
>> Seeing next mail, 
>> http://article.gmane.org/gmane.comp.apache.db.derby.devel/6132
>> I understood DERBY-412 not be fixed in 10.1 branch.
>> //I took this is not a bug , but improvement ....
>>
>> Did I misunderstand ....?
>> If needed, I will merge it to 10.1 branch after DERBY-496 was done.
>>
>> Best regards.
>>
>> /*
>>
>>         Tomohito Nakayama
>>         tomonaka@basil.ocn.ne.jp
>>         tomohito@rose.zero.ad.jp
>>         tmnk@apache.org
>>
>>         Naka
>>         http://www5.ocn.ne.jp/~tomohito/TopPage.html
>>
>> */
>> ----- Original Message ----- From: "David Van Couvering" 
>> <Da...@Sun.COM>
>> To: "Derby Discussion" <de...@db.apache.org>
>> Sent: Tuesday, August 16, 2005 1:38 AM
>> Subject: Re: PooledConnection being closed
>>
>>
>>> With the Connection.toString() that was just checked into the trunk 
>>> (and I think Tomohito backported into the 10.1 branch) you can see if 
>>> the underlying "physical" connection is the same...
>>>
>>> David
>>>
>>> Knut Anders Hatlen wrote:
>>>
>>>> Tony Seebregts <to...@cibecs.com> writes:
>>>>
>>>>  
>>>>
>>>>> Hi,
>>>>>
>>>>> I'm writing a connection pool manager using the
>>>>> EmbeddedConnectionPoolDatasource class. The requesting object gets the
>>>>> Connection object from a PooledConnection  getConnection() , executes
>>>>> a SQL statement and then closes the Connection.
>>>>>
>>>>> This correctly invokes the ConnectionEventListener.close() method -
>>>>> which simply marks the pooled connection as available for reused. But
>>>>> when I try to resuse the connection originally supplied by the
>>>>> PooledConnection getConnection() method the connection is
>>>>> closed. Calling getConnection returns me a new Connection which is
>>>>> (AFAIK) not the idea.
>>>>>   
>>>>
>>>>
>>>> Well, the point with pooled connections is that you use
>>>> getConnection() and close() as with ordinary connections, but the
>>>> underlying physical connection is kept open. The Connection object
>>>> returned by getConnection() is a logical connection, and you cannot
>>>> use it after it is closed. If you call getConnection() again, you will
>>>> get a new logical connection, and therefore a new Connection
>>>> object. However, the new logical connection might still use the same
>>>> physical connection.
>>>>
>>>>  
>>>>
>>>
>>
>>
>> -------------------------------------------------------------------------------- 
>>
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG Anti-Virus.
>> Version: 7.0.338 / Virus Database: 267.10.9/72 - Release Date: 2005/08/14
>>
>>
>>
>


--------------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.9/72 - Release Date: 2005/08/14



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.9/72 - Release Date: 2005/08/14


Re: PooledConnection being closed

Posted by David Van Couvering <Da...@Sun.COM>.
Hi, Tomohito.  I think I misunderstood this email as a request to 
*backport* DERBY-412 to 10.1, but I see it's  request to *forward-port* 
it into the trunk

http://mail-archives.apache.org/mod_mbox/db-derby-dev/200507.mbox/%3c007201c58e14$77a1cdf0$0800a8c0@Arkat%3e

I made my changes to DERBY-412 into the trunk (same as 10.2).    So I 
don't think DERBY-412 needs to be forward-ported into the trunk, right?

I thought perhaps it may be worthwhile to backport DERBY-412 (along with 
DERBY-243) into 10.1.  But you are right, this is an enhancement, and 
thus probably not the right thing to put into a maintenance branch.

David

TomohitoNakayama wrote:

> Hello.
>
> Seeing next mail, 
> http://article.gmane.org/gmane.comp.apache.db.derby.devel/6132
> I understood DERBY-412 not be fixed in 10.1 branch.
> //I took this is not a bug , but improvement ....
>
> Did I misunderstand ....?
> If needed, I will merge it to 10.1 branch after DERBY-496 was done.
>
> Best regards.
>
> /*
>
>         Tomohito Nakayama
>         tomonaka@basil.ocn.ne.jp
>         tomohito@rose.zero.ad.jp
>         tmnk@apache.org
>
>         Naka
>         http://www5.ocn.ne.jp/~tomohito/TopPage.html
>
> */
> ----- Original Message ----- From: "David Van Couvering" 
> <Da...@Sun.COM>
> To: "Derby Discussion" <de...@db.apache.org>
> Sent: Tuesday, August 16, 2005 1:38 AM
> Subject: Re: PooledConnection being closed
>
>
>> With the Connection.toString() that was just checked into the trunk 
>> (and I think Tomohito backported into the 10.1 branch) you can see if 
>> the underlying "physical" connection is the same...
>>
>> David
>>
>> Knut Anders Hatlen wrote:
>>
>>> Tony Seebregts <to...@cibecs.com> writes:
>>>
>>>  
>>>
>>>> Hi,
>>>>
>>>> I'm writing a connection pool manager using the
>>>> EmbeddedConnectionPoolDatasource class. The requesting object gets the
>>>> Connection object from a PooledConnection  getConnection() , executes
>>>> a SQL statement and then closes the Connection.
>>>>
>>>> This correctly invokes the ConnectionEventListener.close() method -
>>>> which simply marks the pooled connection as available for reused. But
>>>> when I try to resuse the connection originally supplied by the
>>>> PooledConnection getConnection() method the connection is
>>>> closed. Calling getConnection returns me a new Connection which is
>>>> (AFAIK) not the idea.
>>>>   
>>>
>>>
>>> Well, the point with pooled connections is that you use
>>> getConnection() and close() as with ordinary connections, but the
>>> underlying physical connection is kept open. The Connection object
>>> returned by getConnection() is a logical connection, and you cannot
>>> use it after it is closed. If you call getConnection() again, you will
>>> get a new logical connection, and therefore a new Connection
>>> object. However, the new logical connection might still use the same
>>> physical connection.
>>>
>>>  
>>>
>>
>
>
> -------------------------------------------------------------------------------- 
>
>
>
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.10.9/72 - Release Date: 2005/08/14
>
>
>

Re: PooledConnection being closed

Posted by TomohitoNakayama <to...@basil.ocn.ne.jp>.
Hello.

Seeing next mail, 
http://article.gmane.org/gmane.comp.apache.db.derby.devel/6132
I understood DERBY-412 not be fixed in 10.1 branch.
//I took this is not a bug , but improvement ....

Did I misunderstand ....?
If needed, I will merge it to 10.1 branch after DERBY-496 was done.

Best regards.

/*

         Tomohito Nakayama
         tomonaka@basil.ocn.ne.jp
         tomohito@rose.zero.ad.jp
         tmnk@apache.org

         Naka
         http://www5.ocn.ne.jp/~tomohito/TopPage.html

*/
----- Original Message ----- 
From: "David Van Couvering" <Da...@Sun.COM>
To: "Derby Discussion" <de...@db.apache.org>
Sent: Tuesday, August 16, 2005 1:38 AM
Subject: Re: PooledConnection being closed


> With the Connection.toString() that was just checked into the trunk (and 
> I think Tomohito backported into the 10.1 branch) you can see if the 
> underlying "physical" connection is the same...
> 
> David
> 
> Knut Anders Hatlen wrote:
> 
>>Tony Seebregts <to...@cibecs.com> writes:
>>
>>  
>>
>>>Hi,
>>>
>>>I'm writing a connection pool manager using the
>>>EmbeddedConnectionPoolDatasource class. The requesting object gets the
>>>Connection object from a PooledConnection  getConnection() , executes
>>>a SQL statement and then closes the Connection.
>>>
>>>This correctly invokes the ConnectionEventListener.close() method -
>>>which simply marks the pooled connection as available for reused. But
>>>when I try to resuse the connection originally supplied by the
>>>PooledConnection getConnection() method the connection is
>>>closed. Calling getConnection returns me a new Connection which is
>>>(AFAIK) not the idea.
>>>    
>>>
>>
>>Well, the point with pooled connections is that you use
>>getConnection() and close() as with ordinary connections, but the
>>underlying physical connection is kept open. The Connection object
>>returned by getConnection() is a logical connection, and you cannot
>>use it after it is closed. If you call getConnection() again, you will
>>get a new logical connection, and therefore a new Connection
>>object. However, the new logical connection might still use the same
>>physical connection.
>>
>>  
>>
>


--------------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.9/72 - Release Date: 2005/08/14



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.9/72 - Release Date: 2005/08/14


Re: PooledConnection being closed

Posted by David Van Couvering <Da...@Sun.COM>.
With the Connection.toString() that was just checked into the trunk (and 
I think Tomohito backported into the 10.1 branch) you can see if the 
underlying "physical" connection is the same...

David

Knut Anders Hatlen wrote:

>Tony Seebregts <to...@cibecs.com> writes:
>
>  
>
>>Hi,
>>
>>I'm writing a connection pool manager using the
>>EmbeddedConnectionPoolDatasource class. The requesting object gets the
>>Connection object from a PooledConnection  getConnection() , executes
>>a SQL statement and then closes the Connection.
>>
>>This correctly invokes the ConnectionEventListener.close() method -
>>which simply marks the pooled connection as available for reused. But
>>when I try to resuse the connection originally supplied by the
>>PooledConnection getConnection() method the connection is
>>closed. Calling getConnection returns me a new Connection which is
>>(AFAIK) not the idea.
>>    
>>
>
>Well, the point with pooled connections is that you use
>getConnection() and close() as with ordinary connections, but the
>underlying physical connection is kept open. The Connection object
>returned by getConnection() is a logical connection, and you cannot
>use it after it is closed. If you call getConnection() again, you will
>get a new logical connection, and therefore a new Connection
>object. However, the new logical connection might still use the same
>physical connection.
>
>  
>

Re: PooledConnection being closed

Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
Tony Seebregts <to...@cibecs.com> writes:

> Hi,
>
> I'm writing a connection pool manager using the
> EmbeddedConnectionPoolDatasource class. The requesting object gets the
> Connection object from a PooledConnection  getConnection() , executes
> a SQL statement and then closes the Connection.
>
> This correctly invokes the ConnectionEventListener.close() method -
> which simply marks the pooled connection as available for reused. But
> when I try to resuse the connection originally supplied by the
> PooledConnection getConnection() method the connection is
> closed. Calling getConnection returns me a new Connection which is
> (AFAIK) not the idea.

Well, the point with pooled connections is that you use
getConnection() and close() as with ordinary connections, but the
underlying physical connection is kept open. The Connection object
returned by getConnection() is a logical connection, and you cannot
use it after it is closed. If you call getConnection() again, you will
get a new logical connection, and therefore a new Connection
object. However, the new logical connection might still use the same
physical connection.

-- 
Knut Anders


Re: PooledConnection being closed

Posted by David Van Couvering <Da...@Sun.COM>.
How are you determining that the connection is closed and that you are 
getting a new connection?

David

Tony Seebregts wrote:

> Hi,
>
> I'm writing a connection pool manager using the 
> EmbeddedConnectionPoolDatasource class. The requesting object gets the 
> Connection object from a PooledConnection  getConnection() , executes 
> a SQL statement and then closes the Connection.
>
> This correctly invokes the ConnectionEventListener.close() method - 
> which simply marks the pooled connection as available for reused. But 
> when I try to resuse the connection originally supplied by the 
> PooledConnection getConnection() method the connection is closed. 
> Calling getConnection returns me a new Connection which is (AFAIK) not 
> the idea.
>
> Any ideas ?
>
> regards
>
> Tony Seebregts
>
>