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 |
Explain the necessary steps to connect to the database in java?
How many categories of jdbc drivers are there?
Does sql allow null values ?
How to get the Database server details in java program?
The new features of the JDBC 2.0 API, will be supported for JDBC-ODBC Bridge?
What is jdbc oracle thin?
What is an escape syntax?
How can I know when I reach the last record in a table, since JDBC doesn't provide an EOF method?
How can you make a connection?
What are the Isolation level in JDBC transaction?
what is the current version of JDBC? and explain its features?
What is odbc and jdbc drivers?