Java J2ee Tutorials

What is Difference Between Statement and PreparedStatement

Tuesday, February 14, 2012

There are four steps for the execution of query such as
  1. Query is parsed,
  2. Query is compile,
  3. Query is optimized
  4. Query is executed
In case of statement interface these four steps are performed, each time when query is submitted for execution. But in case of prepared statement first three steps are performed only once, when the query in initially submitted. Only the last step is performed each time query is submitted (in subsequence submissions), i.e if same query is submitted to be execute with different values multiple times then prepared statement interface provides better perfromance as compared to statement interface.

Free Career Predictions

0 comments:

Post a Comment