Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: preparing the same statement over and over

Re: preparing the same statement over and over

From: agis <stag_at_hq.acn.gr>
Date: Tue, 16 Nov 2004 11:58:03 +0200
Message-ID: <cncj37$2drf$1@ulysses.noc.ntua.gr>

"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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US