What is Statement and PreparedStatement? whatz the
difference?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

RowSetInternal caller and returns void. What can I do in the readData method?

633


How many ways that we can view a result set?

637


Which jdbc driver is the fastest driver?

648


What is @entity in java?

597


What is the most common example type 1 driver?

687






What are the advantages of database connection pooling?

566


How to check jdbc driver version in websphere?

638


Is jdbc connection secure?

583


What is the query used to display all tables names in SQL Server (Query analyzer)?

606


How can we retrieve the file in the oracle database?

596


How to use JDBC to connect Microsoft Access?

671


How do java applications access the database using jdbc?

611


Explain the role of driver in jdbc.

651


What is a statement?

654


explain about special characters?

617