What is Statement and PreparedStatement? whatz the
difference?
Answers were Sorted based on User's Feedback
Answer / harish
When you execute a SQL query with Statement. It parses and
executes in the database each time. Where as in
PreparedStatement, first time it parses and executes and
subsequent times, it directly substitute the values in the
query and executes. It is faster than Statement
| Is This Answer Correct ? | 11 Yes | 2 No |
As harish, said prepared statement is pre-complied so it
will be very fast when compared to normal statement.when we
execute same query again and again for different set of
input data.
code snippet for this is :--
for normal statement :
Statement st = conn.createStatement();
for prepared statement :
PreparedStatement prSt = conn.prepareStatement
("query") ;
// set values for input paramenters and execute as usual.
| Is This Answer Correct ? | 2 Yes | 2 No |
What is drivermanager in jdbc?
signature of init method?
What are jdbc and its components?
How can I connect mysql or oracle with java?
What is an outer join?
Explain creation of statement object with connection method create method with help of an example.
Which is best database for java?
What do you mean by jdbc batch processing and what are the advantages of using jdbc batch processing?
What is two-phase commit in the database?
What are the higher level apis under development on top of jdbc currently?
how we can remove hard code in java?
What is JDBC Statement?