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.
James Carman, President<br />Carman Consulting, Inc.
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
Joined: Feb 23, 2005
Thanks for your reply...
The explanation is very clear.
once again Thanks
subject: doubt about PreparedStatement and Statement