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 are drivers available?
List the common jdbc exceptions ?
Why do we use jdbc?
How do I connect to jdbc?
How to execute bulk number of queries at once?
How to store images in database?
Without using of Class.forName(? ?), how do you connect to db?
What are dml and ddl?
What is JDBC RowSet? What are different types of RowSet?
What is the difference between Union, Unionall ?
Why do we use jdbc in java?
After creating conntinpool in weblogic how to write the code in programe where i can use that pool object in the programe connecting to the database and how to debug programe withou eclipse