You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Dirk Verbeeck <di...@pandora.be> on 2005/02/25 19:38:55 UTC
Re: [DBCP] Re: Repost: Help with PreparedStatement pooling
The mail with zipfile was rejected.
You can download the testcase here:
http://cvs.apache.org/~dirkv/DBCPTest.zip
-- Dirk
Dirk Verbeeck wrote:
> I now tried to reproduce you problem using the official release jars in
> a new project but everything works as expected.
>
> I'm attaching my test eclipse project. It is using the test driver from
> dbcp test directories. You also need to include dbcp-1.2.1, pool-1.2 and
> collections-3.1.
>
> Let me know if this works for you.
>
> -- Dirk
>
> Edward Q. Bridges wrote:
>
>>
>> Sorry for the repost, but after working with this further, I'm really
>> stuck as to how I may confirm whether or not statement pooling is
>> really working.
>>
>> As far as I can tell, I'm getting new instances (i.e. == is returning
>> false) of an innermost delegate statement for the same SQL query on
>> the same connection. This does not sound correct. Maybe I'm missing
>> something?
>>
>> Thanks in advance for any comments.
>>
>>
>> Edward Q. Bridges wrote:
>>
>>> Dirk, the code you provided isn't working for me (see below).
>>> I'm thinking that my configuration is wrong. Can someone please
>>> double check what I'm doing to configure it? The complete
>>> configuration is below, but here's the key part:
>>>
>>> KeyedObjectPoolFactory stmtPoolFactory = new
>>> GenericKeyedObjectPoolFactory(null);
>>>
>>> PoolableConnectionFactory x = new PoolableConnectionFactory(
>>> connFactory,
>>> connPool,
>>> stmtPoolFactory,
>>> cfg.getValidationQuery(),
>>> cfg.isDefaultReadOnly(),
>>> cfg.isDefaultAutoCommit(),
>>> cfg.getDefaultTransactionIsolation()
>>> );
>>>
>>> Do I need to provide something else to the GenericKeyedObjectPoolFactory
>>>
>>> besides a "null" value before giving it over to the
>>> PoolableConnectionFactory?
>>>
>>>
>>>
>>> I copied and pasted what you provide as such:
>>>
>>> conn = ds.getConnection();
>>> stmt1 = conn.prepareStatement("select getDate()");
>>> Statement ustmt1 = ((DelegatingStatement) stmt1)
>>> .getInnermostDelegate();
>>> stmt1.close();
>>> stmt2 = conn.prepareStatement("select getDate()");
>>> Statement ustmt2 = ((DelegatingStatement) stmt2)
>>> .getInnermostDelegate();
>>> stmt2.close();
>>> assertSame(ustmt1, ustmt2);
>>>
>>> And I get this:
>>>
>>> junit.framework.AssertionFailedError:
>>> expected same:<co...@19b5393>
>>> was not: <co...@8bdcd2>
>>>
>>> When I change to use assertEquals() (assertSame() uses "=="):
>>>
>>> junit.framework.AssertionFailedError:
>>> expected:<co...@19b5393>
>>> but was: <co...@8bdcd2>
>>>
>>> Thanks in advance.
>>> Ed
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org