• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

doubt about PreparedStatement and Statement

 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I know the difference between PreparedStatement and Statement.

1)But i want to know, if PreparedStatment is a precompiled query,what it mean??

2) when it compiles and where it store a compiled query??

3) How Statement object compiles??

please clarify...........


thanks in advance
Gopal
[ August 05, 2005: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, you don't really need to know how it happens. It just does. It's definitely faster, for the most part, especially if you're going to run the same query many times. Also, PreparedStatements are safer. You don't have to worry about the "'" character when building up an OQL string if you're binding in query parameters.
 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gopal
As you know PreparedStatements are subclass of Statements. It means PreparedStatement does something special, that is when you execute a PreparedStatement for the first time, the query string gets executed, during which a execuation plan is made for that query and maintained for all the further calls for the same query at db level, where for Statement when the query IS FIRED, each time a new execution plan is created.
Creation of this plan is a heavy process looking at number of user hitting the website.
As u can see this makes PreparedStatement much faster than the Statements. Morever u have the flexibility of passing the parameters to the PreparedStatement.

Hope this answers your query.
Let me know

If i am wrong, please correct me.

Regards
Makarand Parab
 
gopal kishan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI All,

Thanks for your reply...

The explanation is very clear.

once again Thanks

regards
Gopal
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic