You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Koka Kiknadze <22...@gmail.com> on 2007/01/11 13:24:33 UTC

Prepared Statement caching

Hi,

Recently I posted the following question, but got no answer. Maybe it's
wrong question or maybe it was wrong time to ask (too close to Christmas).

With iBatis 2.3 I have two options:

Set statementCahingEnabled = "true" in my configuration and also, as I'm
using DBCP, I can set also DBCP property poolPreparedStatements = "true".

Both seem to address same thing, so is it correct to think that enabling
statementCahingEnabled  makes sense with SimpleDataSourse,  but  is
redundant with DBCP with poolPreparedStatements =true?


TYA

Re: Prepared Statement caching

Posted by Koka Kiknadze <22...@gmail.com>.
I want to report our findings in case someone stumbles across this thread.

DBCP realization of poolPreparedStatements seems to contain bug. We observed
that in a rare cases under heavy load some statements (procedure calls and
select statements) were executed on different physical connections
(monitored using database tracelog). We had no time to dig deeper, but now
when we disabled statement caching the problem has gone,

On the other hand there is no perforamce degradation, as the database
(TimesTen in this case, but sure Oracle will do same) has capabilities to
reuse prepared statements, i.e. has its own statement cache, so it seems
that any kind of statement caching on the client side is redundant if the
same can be done by configuring database options.

Re: Prepared Statement caching

Posted by Brandon Goodin <br...@gmail.com>.
I am unsure what DBCP does. It sounds like it would do something similar.
But, as for iBATIS the statement caching is used in the SessionScope. This
means that the cache doesn't persist across unrelated calls (obviously). It
only exists for the duration of the connection being used. If you demarcate
a transaction and call SQL that is able to use the same PreparedStatement it
will create the first one and resuse it for all subsequent calls by retrieve
it from the prepared statement cache. So, if that is the same as the DBCP...
you can decide to use whichever you wish.

Brandon

On 1/11/07, Koka Kiknadze <22...@gmail.com> wrote:
>
> Hi,
>
> Recently I posted the following question, but got no answer. Maybe it's
> wrong question or maybe it was wrong time to ask (too close to Christmas).
>
> With iBatis 2.3 I have two options:
>
> Set statementCahingEnabled = "true" in my configuration and also, as I'm
> using DBCP, I can set also DBCP property poolPreparedStatements = "true".
>
> Both seem to address same thing, so is it correct to think that enabling
> statementCahingEnabled  makes sense with SimpleDataSourse,  but  is
> redundant with DBCP with poolPreparedStatements =true?
>
>
> TYA
>