Re: Java prepared statements

  • From: "Giovanni Cuccu" <giovanni.cuccu@xxxxxxxxx>
  • To: paul.baumgartel@xxxxxxxxxxxxxxxxx
  • Date: Wed, 22 Mar 2006 09:50:15 +0100

Hi Paul,
   you are right, using the prepared statement the hard parse does not
occur every time the statement is executed. If you open and close the
prepared statement a soft parse will occur every ps execution. There
is an oracle jdbc parameter that enables prepared statement caching
(there is the 14th chapter on Oracle JDBC documentation dedicated to
his topic), but it works only if you execute your calls inside the
same JVM; re-reading your post it seems that a new JVM is started and
terminated for every call, but I may be wrong.
Hope it helps,
    Giovanni

On 3/21/06, Baumgartel, Paul <paul.baumgartel@xxxxxxxxxxxxxxxxx> wrote:
> For you Java experts, a question:
>
> I am asking a developer to replace multiple (hundreds of thousands!) 
> statements using literals with a single statement using binds.  This, I 
> gather, is the purpose of a Java "prepared statement".  The developer tells 
> me that an external program calls this Java utility, which would create the 
> prepared statement each time it's called, bind the variables, and execute 
> (it's a simple delete from ...where column = value).
>
> Will this result in a single SQL statement in the shared pool, hard parsed 
> only once?  Will it be soft parsed each time it's created?  If so, that 
> should achieve the desired result of reducing hard parses (this database 
> suffers from very several library cache/shared pool latch contention).  Is 
> there a way to go even further and eliminate soft parsing, too?
>
> 9iR2 on Solaris, Oracle JDBC driver.
>
> Thanks,
>
>
> Paul Baumgartel
> paul.baumgartel@xxxxxxxxxxxxxxxxx
> 212.538.1143
>
>
> ==============================================================================
> Please access the attached hyperlink for an important electronic 
> communications disclaimer:
>
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> ==============================================================================
>
> --
> //www.freelists.org/webpage/oracle-l
>
>
>


--
--------------------------------------------------------------------
Another free oracle resource profiler
http://sourceforge.net/projects/oraresprof/
Now version 0.9
--
//www.freelists.org/webpage/oracle-l


Other related posts: