You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Guillermo Fernandes <gs...@gmail.com> on 2009/12/15 18:34:56 UTC

tomcat jdbc pool is not proxying resultSets and preparedStatements

Hi,

I'm using ddlutils 1.0 and tomcat jdbc pool 1.0.7.1 and I getting an error
due to a connection is closed and the pool is not aware of that.
Basically the issue is that ddlutils has a resultset iterator and when it
finishes it closes the connection by getting it from the *
resultSet.preparedStatement.connection* and the connection returned is not
the proxy that the pool has created.

So the issue happens when another client retrieves a connection from the
pool because the pool returns a connection that was actually closed.
Why tomcat jdbc pool is not creating proxies for preparedStatements and
resultSets like commons-dbcp?

Is there any other way to address this issue?

Thanks,
Guillermo

Re: tomcat jdbc pool is not proxying resultSets and preparedStatements

Posted by Guillermo Fernandes <gs...@gmail.com>.
You're welcome

On Thu, Dec 17, 2009 at 11:55 AM, Filip Hanik - Dev Lists <
devlists@hanik.com> wrote:

> Thank you very much!
>
>
> On 12/17/2009 07:11 AM, Guillermo Fernandes wrote:
>
>> I have attached the interceptor to the bugzilla ticket. Actually, it
>> extends
>> the AbstractStatementInterceptor.
>>
>> Guillermo.
>>
>> On Wed, Dec 16, 2009 at 4:47 PM, Filip Hanik - Dev Lists<
>> devlists@hanik.com
>>
>>
>>> wrote:
>>>
>>>
>>
>>
>>> correct, there is an AbstractStatementInterceptor that you would extend
>>> in
>>> order to write such an extension.
>>>
>>> Filip
>>>
>>>
>>>
>>> On 12/16/2009 06:02 AM, Guillermo Fernandes wrote:
>>>
>>>
>>>
>>>> Hi Filip,
>>>>
>>>> Yes, we are aware that the API allow us to write our own JdbcInterceptor
>>>> so
>>>> we are writing an interceptor to handle this issue by creating a proxy
>>>> for
>>>> the statement and resultSet.
>>>>
>>>> We will attach it to the bugzilla ticket as a workaround, but we think
>>>> the
>>>> issue should be fixed inside the jdbc-pool (it could be a "fixed"
>>>> JdbcInterceptor).
>>>>
>>>> Thanks,
>>>> Guillermo
>>>>
>>>> On Wed, Dec 16, 2009 at 12:19 AM, Filip Hanik - Dev Lists<
>>>> devlists@hanik.com>   wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> On 12/15/2009 10:34 AM, Guillermo Fernandes wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm using ddlutils 1.0 and tomcat jdbc pool 1.0.7.1 and I getting an
>>>>>> error
>>>>>> due to a connection is closed and the pool is not aware of that.
>>>>>> Basically the issue is that ddlutils has a resultset iterator and when
>>>>>> it
>>>>>> finishes it closes the connection by getting it from the *
>>>>>> resultSet.preparedStatement.connection* and the connection returned is
>>>>>> not
>>>>>> the proxy that the pool has created.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> wow, that seems backwards, but since the API allows you to do so, I
>>>>> would
>>>>> guess its a valid use case.
>>>>>
>>>>>  So the issue happens when another client retrieves a connection from
>>>>> the
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> pool because the pool returns a connection that was actually closed.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> validationQuery="..." and testOnBorrow="true" would take care of this
>>>>> as
>>>>> a
>>>>> work around for now.
>>>>>
>>>>>  Why tomcat jdbc pool is not creating proxies for preparedStatements
>>>>> and
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> resultSets like commons-dbcp?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> performance of course, the lesser the better.
>>>>> SlowQueryReport interceptor already has an example of this, so its
>>>>> doable.
>>>>>
>>>>>  Is there any other way to address this issue?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> see work around above
>>>>>
>>>>> Filip
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Thanks,
>>>>>> Guillermo
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>
>>>
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: tomcat jdbc pool is not proxying resultSets and preparedStatements

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Thank you very much!

On 12/17/2009 07:11 AM, Guillermo Fernandes wrote:
> I have attached the interceptor to the bugzilla ticket. Actually, it extends
> the AbstractStatementInterceptor.
>
> Guillermo.
>
> On Wed, Dec 16, 2009 at 4:47 PM, Filip Hanik - Dev Lists<devlists@hanik.com
>    
>> wrote:
>>      
>    
>> correct, there is an AbstractStatementInterceptor that you would extend in
>> order to write such an extension.
>>
>> Filip
>>
>>
>>
>> On 12/16/2009 06:02 AM, Guillermo Fernandes wrote:
>>
>>      
>>> Hi Filip,
>>>
>>> Yes, we are aware that the API allow us to write our own JdbcInterceptor
>>> so
>>> we are writing an interceptor to handle this issue by creating a proxy for
>>> the statement and resultSet.
>>>
>>> We will attach it to the bugzilla ticket as a workaround, but we think the
>>> issue should be fixed inside the jdbc-pool (it could be a "fixed"
>>> JdbcInterceptor).
>>>
>>> Thanks,
>>> Guillermo
>>>
>>> On Wed, Dec 16, 2009 at 12:19 AM, Filip Hanik - Dev Lists<
>>> devlists@hanik.com>   wrote:
>>>
>>>
>>>
>>>        
>>>> On 12/15/2009 10:34 AM, Guillermo Fernandes wrote:
>>>>
>>>>
>>>>
>>>>          
>>>>> Hi,
>>>>>
>>>>> I'm using ddlutils 1.0 and tomcat jdbc pool 1.0.7.1 and I getting an
>>>>> error
>>>>> due to a connection is closed and the pool is not aware of that.
>>>>> Basically the issue is that ddlutils has a resultset iterator and when
>>>>> it
>>>>> finishes it closes the connection by getting it from the *
>>>>> resultSet.preparedStatement.connection* and the connection returned is
>>>>> not
>>>>> the proxy that the pool has created.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>            
>>>> wow, that seems backwards, but since the API allows you to do so, I would
>>>> guess its a valid use case.
>>>>
>>>>   So the issue happens when another client retrieves a connection from the
>>>>
>>>>
>>>>          
>>>>> pool because the pool returns a connection that was actually closed.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>            
>>>> validationQuery="..." and testOnBorrow="true" would take care of this as
>>>> a
>>>> work around for now.
>>>>
>>>>   Why tomcat jdbc pool is not creating proxies for preparedStatements and
>>>>
>>>>
>>>>          
>>>>> resultSets like commons-dbcp?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>            
>>>> performance of course, the lesser the better.
>>>> SlowQueryReport interceptor already has an example of this, so its
>>>> doable.
>>>>
>>>>   Is there any other way to address this issue?
>>>>
>>>>
>>>>          
>>>>>
>>>>>
>>>>>            
>>>> see work around above
>>>>
>>>> Filip
>>>>
>>>>
>>>>
>>>>          
>>>>> Thanks,
>>>>> Guillermo
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>            
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>>
>>      
>    


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


Re: tomcat jdbc pool is not proxying resultSets and preparedStatements

Posted by Guillermo Fernandes <gs...@gmail.com>.
I have attached the interceptor to the bugzilla ticket. Actually, it extends
the AbstractStatementInterceptor.

Guillermo.

On Wed, Dec 16, 2009 at 4:47 PM, Filip Hanik - Dev Lists <devlists@hanik.com
> wrote:

> correct, there is an AbstractStatementInterceptor that you would extend in
> order to write such an extension.
>
> Filip
>
>
>
> On 12/16/2009 06:02 AM, Guillermo Fernandes wrote:
>
>> Hi Filip,
>>
>> Yes, we are aware that the API allow us to write our own JdbcInterceptor
>> so
>> we are writing an interceptor to handle this issue by creating a proxy for
>> the statement and resultSet.
>>
>> We will attach it to the bugzilla ticket as a workaround, but we think the
>> issue should be fixed inside the jdbc-pool (it could be a "fixed"
>> JdbcInterceptor).
>>
>> Thanks,
>> Guillermo
>>
>> On Wed, Dec 16, 2009 at 12:19 AM, Filip Hanik - Dev Lists<
>> devlists@hanik.com>  wrote:
>>
>>
>>
>>> On 12/15/2009 10:34 AM, Guillermo Fernandes wrote:
>>>
>>>
>>>
>>>> Hi,
>>>>
>>>> I'm using ddlutils 1.0 and tomcat jdbc pool 1.0.7.1 and I getting an
>>>> error
>>>> due to a connection is closed and the pool is not aware of that.
>>>> Basically the issue is that ddlutils has a resultset iterator and when
>>>> it
>>>> finishes it closes the connection by getting it from the *
>>>> resultSet.preparedStatement.connection* and the connection returned is
>>>> not
>>>> the proxy that the pool has created.
>>>>
>>>>
>>>>
>>>>
>>> wow, that seems backwards, but since the API allows you to do so, I would
>>> guess its a valid use case.
>>>
>>>  So the issue happens when another client retrieves a connection from the
>>>
>>>
>>>> pool because the pool returns a connection that was actually closed.
>>>>
>>>>
>>>>
>>>>
>>> validationQuery="..." and testOnBorrow="true" would take care of this as
>>> a
>>> work around for now.
>>>
>>>  Why tomcat jdbc pool is not creating proxies for preparedStatements and
>>>
>>>
>>>> resultSets like commons-dbcp?
>>>>
>>>>
>>>>
>>>>
>>> performance of course, the lesser the better.
>>> SlowQueryReport interceptor already has an example of this, so its
>>> doable.
>>>
>>>  Is there any other way to address this issue?
>>>
>>>
>>>>
>>>>
>>>>
>>> see work around above
>>>
>>> Filip
>>>
>>>
>>>
>>>> Thanks,
>>>> Guillermo
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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: tomcat jdbc pool is not proxying resultSets and preparedStatements

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
correct, there is an AbstractStatementInterceptor that you would extend 
in order to write such an extension.

Filip


On 12/16/2009 06:02 AM, Guillermo Fernandes wrote:
> Hi Filip,
>
> Yes, we are aware that the API allow us to write our own JdbcInterceptor so
> we are writing an interceptor to handle this issue by creating a proxy for
> the statement and resultSet.
>
> We will attach it to the bugzilla ticket as a workaround, but we think the
> issue should be fixed inside the jdbc-pool (it could be a "fixed"
> JdbcInterceptor).
>
> Thanks,
> Guillermo
>
> On Wed, Dec 16, 2009 at 12:19 AM, Filip Hanik - Dev Lists<
> devlists@hanik.com>  wrote:
>
>    
>> On 12/15/2009 10:34 AM, Guillermo Fernandes wrote:
>>
>>      
>>> Hi,
>>>
>>> I'm using ddlutils 1.0 and tomcat jdbc pool 1.0.7.1 and I getting an error
>>> due to a connection is closed and the pool is not aware of that.
>>> Basically the issue is that ddlutils has a resultset iterator and when it
>>> finishes it closes the connection by getting it from the *
>>> resultSet.preparedStatement.connection* and the connection returned is not
>>> the proxy that the pool has created.
>>>
>>>
>>>        
>> wow, that seems backwards, but since the API allows you to do so, I would
>> guess its a valid use case.
>>
>>   So the issue happens when another client retrieves a connection from the
>>      
>>> pool because the pool returns a connection that was actually closed.
>>>
>>>
>>>        
>> validationQuery="..." and testOnBorrow="true" would take care of this as a
>> work around for now.
>>
>>   Why tomcat jdbc pool is not creating proxies for preparedStatements and
>>      
>>> resultSets like commons-dbcp?
>>>
>>>
>>>        
>> performance of course, the lesser the better.
>> SlowQueryReport interceptor already has an example of this, so its doable.
>>
>>   Is there any other way to address this issue?
>>      
>>>
>>>        
>> see work around above
>>
>> Filip
>>
>>      
>>> Thanks,
>>> Guillermo
>>>
>>>
>>>
>>>        
>>
>> ---------------------------------------------------------------------
>> 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: tomcat jdbc pool is not proxying resultSets and preparedStatements

Posted by Guillermo Fernandes <gs...@gmail.com>.
Hi Filip,

Yes, we are aware that the API allow us to write our own JdbcInterceptor so
we are writing an interceptor to handle this issue by creating a proxy for
the statement and resultSet.

We will attach it to the bugzilla ticket as a workaround, but we think the
issue should be fixed inside the jdbc-pool (it could be a "fixed"
JdbcInterceptor).

Thanks,
Guillermo

On Wed, Dec 16, 2009 at 12:19 AM, Filip Hanik - Dev Lists <
devlists@hanik.com> wrote:

> On 12/15/2009 10:34 AM, Guillermo Fernandes wrote:
>
>> Hi,
>>
>> I'm using ddlutils 1.0 and tomcat jdbc pool 1.0.7.1 and I getting an error
>> due to a connection is closed and the pool is not aware of that.
>> Basically the issue is that ddlutils has a resultset iterator and when it
>> finishes it closes the connection by getting it from the *
>> resultSet.preparedStatement.connection* and the connection returned is not
>> the proxy that the pool has created.
>>
>>
> wow, that seems backwards, but since the API allows you to do so, I would
> guess its a valid use case.
>
>  So the issue happens when another client retrieves a connection from the
>> pool because the pool returns a connection that was actually closed.
>>
>>
> validationQuery="..." and testOnBorrow="true" would take care of this as a
> work around for now.
>
>  Why tomcat jdbc pool is not creating proxies for preparedStatements and
>> resultSets like commons-dbcp?
>>
>>
> performance of course, the lesser the better.
> SlowQueryReport interceptor already has an example of this, so its doable.
>
>  Is there any other way to address this issue?
>>
>>
> see work around above
>
> Filip
>
>> Thanks,
>> Guillermo
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: tomcat jdbc pool is not proxying resultSets and preparedStatements

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
On 12/15/2009 10:34 AM, Guillermo Fernandes wrote:
> Hi,
>
> I'm using ddlutils 1.0 and tomcat jdbc pool 1.0.7.1 and I getting an error
> due to a connection is closed and the pool is not aware of that.
> Basically the issue is that ddlutils has a resultset iterator and when it
> finishes it closes the connection by getting it from the *
> resultSet.preparedStatement.connection* and the connection returned is not
> the proxy that the pool has created.
>    
wow, that seems backwards, but since the API allows you to do so, I 
would guess its a valid use case.
> So the issue happens when another client retrieves a connection from the
> pool because the pool returns a connection that was actually closed.
>    
validationQuery="..." and testOnBorrow="true" would take care of this as 
a work around for now.
> Why tomcat jdbc pool is not creating proxies for preparedStatements and
> resultSets like commons-dbcp?
>    
performance of course, the lesser the better.
SlowQueryReport interceptor already has an example of this, so its doable.
> Is there any other way to address this issue?
>    
see work around above

Filip
> Thanks,
> Guillermo
>
>    


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


Re: tomcat jdbc pool is not proxying resultSets and preparedStatements

Posted by Guillermo Fernandes <gs...@gmail.com>.
Ok, I agree it is a bug. I have created the ticket:
https://issues.apache.org/bugzilla/show_bug.cgi?id=48392

<https://issues.apache.org/bugzilla/show_bug.cgi?id=48392>Actually I'm using
commons-dbcp but were are not getting good performance results so I wanted
to try out with the tomcat jdbc-pool.

Thanks,
Guillermo

On Tue, Dec 15, 2009 at 3:25 PM, Mark Thomas <ma...@apache.org> wrote:

> On 15/12/2009 17:34, Guillermo Fernandes wrote:
> > Hi,
> >
> > I'm using ddlutils 1.0 and tomcat jdbc pool 1.0.7.1 and I getting an
> error
> > due to a connection is closed and the pool is not aware of that.
> > Basically the issue is that ddlutils has a resultset iterator and when it
> > finishes it closes the connection by getting it from the *
> > resultSet.preparedStatement.connection* and the connection returned is
> not
> > the proxy that the pool has created.
> >
> > So the issue happens when another client retrieves a connection from the
> > pool because the pool returns a connection that was actually closed.
> > Why tomcat jdbc pool is not creating proxies for preparedStatements and
> > resultSets like commons-dbcp?
>
> That would be a bug. Please create a bugzilla entry.
>
> > Is there any other way to address this issue?
>
> Use DBCP or one of the other connection pools?
>
> Mark
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: tomcat jdbc pool is not proxying resultSets and preparedStatements

Posted by Mark Thomas <ma...@apache.org>.
On 15/12/2009 17:34, Guillermo Fernandes wrote:
> Hi,
> 
> I'm using ddlutils 1.0 and tomcat jdbc pool 1.0.7.1 and I getting an error
> due to a connection is closed and the pool is not aware of that.
> Basically the issue is that ddlutils has a resultset iterator and when it
> finishes it closes the connection by getting it from the *
> resultSet.preparedStatement.connection* and the connection returned is not
> the proxy that the pool has created.
> 
> So the issue happens when another client retrieves a connection from the
> pool because the pool returns a connection that was actually closed.
> Why tomcat jdbc pool is not creating proxies for preparedStatements and
> resultSets like commons-dbcp?

That would be a bug. Please create a bugzilla entry.

> Is there any other way to address this issue?

Use DBCP or one of the other connection pools?

Mark



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