What are the different types of statements?

Answer Posted / rashmi

there are 3 types of statements used in jdbc
------
1.createStatement()
2.preparedStatement()
3.callableStatement()


createStatement returns the object of statement.through this we can call methods belongs

to the statement interface.preparedStatement returns the object of preparedstatement.through this we can call methods belongs

to the preparedstatement interface.

The difference b/w statement and preparedstatement is :

if we use statement the sql querry parses by the database server each and every time.when

we send the request. but by using preparedstatement the sql querry parses only once and that

parsed querry is used every time.

for example if there are 100 sql statements by using statement 100 parsings are necessary.

but by using preparedStatement the parsing is happened only once.so we can save the 99 parsings.

The callablestatement is used to call the storedprocedures.

Is This Answer Correct ?    15 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are temp tables ?

532


How many types of statements are there in jdbc?

493


What is jdbc and its types?

494


What is type 4 jdbc driver?

480


What is jdbc driver manager?

497






Where can I find ojdbc14 jar file?

490


Does jdbctemplate use prepared statements?

511


Why is odbc needed?

494


Why did my jdbc code throw a rollback sqlexception?

502


What are the higher level apis under development on top of jdbc currently?

487


Is not bound in this context unable to find jdbc spring boot?

493


Explain in detail about JDBC and its general features?

527


Jdbc-odbc bridge is multi-threaded or not?

526


How to get the Database server details in java program?

571


How to check jdbc driver version in sql server?

477