• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

precompilation of PreparedStatements

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do we mean by precompiled nature of preparedstatements? where are these statements complied and stored?
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PreparedStatement is more efficient than Statement object if you are executing similar statements multiple times. When a PreparedStatement is created, the SQL statement is sent to the database for precompilation. The precompiled form of a prepared statement is cached only as long as the PreparedStatement instance is alive, so the performance benefits are only obtained when reusing the same PreparedStatement instance, setting different parameters on each invocation.
 
Joice Jose
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check this
 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This depends on the database.

Oracle for instance will cache parsed SQL and execution plans in its own shared memory area. They will stay there even if the session that first submitted it drops the connection, unless and until they are aged out by more recently requested statements needing the space.
[ December 12, 2006: Message edited by: Chris Hendy ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic