callable is interface or class ?

Answer Posted / hazarath k

Yes Callable is an interface. Actually 3 ineterfaces are
provided in java for retreiving the data from DB.Those are:
1.Statement
2.PreparedStatement
3.Callable Statement

Every vendor provide their own implementations for these
interfaces.

If we use Statement object, then the SQL query is parsed
and executed each and every time when the request comes.
If the SQL statement is same but with different values <--
in this scenario no need of parsing each time,only
execution is needed, because same statement is sending to
the server several times but with different values.In this
scenario it is better to parse the statement for first time
only, later onwards it is better to send only values. So in
this situations, it is better to go for
PreparedStatement.It increases the speed also.

If you are planing to call the stored procedures from front
end, then it is better to use Callable statement.

EX(syntax):

Connection con=DriverManager.getConnection("----
","userID","pwd"):
CallableStatement cstmt=con.prepareCall('{call
procedureName}');

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does the JDBC-ODBC Bridge work with Microsoft J++?

1874


What are the differences between execute, executequery, and executeupdate?

493


State the three different ways in which you can create a table?

522


What causes no suitable driver error?

551


What is createstatement method in java?

516






How can we retrieve the file in the oracle database?

520


What are the basic exceptions in jdbc?

533


What is an escape syntax?

535


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

559


How can we store and retrieve images from the database?

517


What is the use of jdbc api?

512


What is resultsetmetadata?

506


What are the main steps in java to make JDBC connectivity?

577


How can I instantiate and load a new CachedRowSet object from a non-JDBC source?

541


explain about special characters?

544