File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Statement v/s PreparedStatement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Statement v/s PreparedStatement " Watch "Statement v/s PreparedStatement " New topic
Author

Statement v/s PreparedStatement

Abhijit Kangale
Ranch Hand

Joined: Sep 17, 2009
Posts: 39
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

Joined: Feb 19, 2007
Posts: 157
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:








R6i
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Statement v/s PreparedStatement
 
Similar Threads
Tell me the main difference between Statement and PreparedStatement?
statement Vs prepared statement for ordinary select queries
Diff b/w Statement and PreparedStatement
pre-compile and prepared statement
Prepared Statement