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 jdbc and its types?
i am user who logined the application..after that another valid user will also logind..so that is it neccessary to create jdbc connection for each and every user...plz explain it with proper answer...plz help me
What are the steps involved in establishing a connection using jdbc in java?
What should be done for auto generating primary key id in a table ?
what are the Different types of exceptions in JDBC?
What is jdbc and why is it required?
Which database is used for java?
How can we store and retrieve images from the database?
Why do we use jdbc statements?
How can I manage special characters when I execute an insert query?
Explain the various types of locking system in jdbc?
What do you mean by jdbc batch processing and what are the advantages of using jdbc batch processing?