WHAT IS THE DIFFERENCE BETWEEN PREPAREDSTATEMENT AND STATEMENT IN JAVA?

Anupam Mishra

Total Post:23

Points:115
Posted by  Anupam Mishra
Java  J2EE 
 564  View(s)
Ratings:
Rate this:
  1. Anupam Mishra

    Post:23

    Points:115
    What is the difference between PreparedStatement and Statement in java?


    1.A statement is parsed and executed each time its call sent to database.
    2. A prepared statement may be parsed once and executed repeatedly with different parameters.

    There are four steps for the execution of query:

    1. Query is parsed

    2.Query is compiled.

    3. Query is optimized.

    4. Query is executed.

    In case of statement, the above four steps are performed every time. And in case of prepared statement the above three steps are performed once.


      Modified On Mar-17-2016 01:26:47 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!