• 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

How Does PreparedStatement Work internally

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Java Pals,
Can any explain exactly, how PreparedStatemet Works? Any how excatly it makes difference in preformace compared to its base class Statement Class?

I request people to explain the internal aspects of working, I found only its syntax and usage on sites but no where i found its internal working. It will be helpful to all, if you give citation to refer.

Thanks,
Vikram
 
Ranch Hand
Posts: 381
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question cannot really be answered because it depends on the driver.

There are essentially two ways in which it works.

One: The driver parses your query and identifies parameters. When you set the parameters the driver stores them and when you execute the driver builds the query from it's parsed bits and the bound parameters.

Two : The driver sends the query to the database where it is parsed (and perhaps a query plan is compiled) and a handle of some sort is returned to the driver. The driver then passes along the setXXX method calls and execute calls to the database directly.

And there can of course be variations of either. Like I said it depends on the database and driver. If this does not satisfy you then you can consult the source for one of the open source drivers like Jtds or the MySQL driver.
 
money grubbing section goes here:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic