What is Statement and PreparedStatement? whatz the
difference?

Answers were Sorted based on User's Feedback



What is Statement and PreparedStatement? whatz the difference?..

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

What is Statement and PreparedStatement? whatz the difference?..

Answer / kalyan

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

Post New Answer

More JDBC Interview Questions

What are the common jdbc exceptions?

0 Answers  


What is phantom read and which isolation level prevents it?

0 Answers  


HI ALL, How to Overcome "OutOfMemoryException"? when I am compiling source having more than 1000 LOC throwing this exception. Can any one give correct answer to my question? thx

5 Answers  


What is batch processing and how to perform batch processing in jdbc?

0 Answers  


What are the differences between stored procedure and functions?

0 Answers  






Differentiate between type_scroll_insensitive and type_scroll_sensitive.

0 Answers  


How a driver can be loaded?

1 Answers  


If you are truncated using JDBC, how can you that how much data is truncated?

0 Answers  


What is jdbc and explain jdbc architecture?

0 Answers  


Why do I get UnsatisfiedLinkError when I try to use my JDBC driver?

0 Answers  


What does the jdbc connection interface?

0 Answers  


What is resultset?

0 Answers  


Categories