Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Statement v/s PreparedStatement

 
Abhijit Kangale
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

PreparedStatement is called pre compiled statement but Statement is not why?
How PreparedStatement is pre compiled?

Regards,
ABHIJIT
 
M K Rayapudi
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In case of PreparedStatement, the skeleton of an SQL statement is prepared/compiled during it's creation/instantiation.
For e.g.

place holders (? marks) are used instead of actual values, this skeleton is compiled before going to execute with the actual values, as follows:

----------------
In case of Statement, no SQL statement is prepared/compiled during creation/instantiation.
For e.g.
.
Later, the SQL statement with values together executed as follows:







 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic