Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: preparing the same statement over and over
"Markus" <MHasenoehrl_at_gmx.net> wrote in message
news:d3091c17.0411150524.734bc458_at_posting.google.com...
> Hi!
>
> I am just looking at some code of a Java persistance framework that
> has a string-constant containing SQL-query and everytime the database
> is read, this statement is prepared again ... hmm ... never seen such
> a thing before, therefore my question:
>
> How much is the penalty for re-preparing an already prepared
> statement? I assume Oracle will not re-prepare it from scratch but use
> it's cache, so is the penalty just a network-roundtrip or is it (as I
> fear) higher?
>
> Mant thanks!
> Markus
Markus,
are u using conection pooling ? If yes u must use JDBC statement cache in order not to reparse the prepared statement.
When u say 'the database is read' i get the idea that u reconnect. Try to avoid this if u can.
Preape is parse so even if it is allready parsed if u prepare u parse it again !!!
So use statement caching to avoid this . Received on Tue Nov 16 2004 - 03:58:03 CST