Why is prepared Statement, Callable Statement used for? What
is the need of Batch updates?

Answer Posted / chaitanya

The main feature of a PreparedStatement object is that,
unlike a Statement object, it is given an SQL statement
when it is created. The advantage to this is that in most
cases, this SQL statement is sent to the DBMS right away,
where it is compiled. As a result, the PreparedStatement
object contains not just an SQL statement, but an SQL
statement that has been precompiled. This means that when
the PreparedStatement is executed, the DBMS can just run
the PreparedStatement SQL statement without having to
compile it first.

Callable Statement:A CallableStatement object provides a
way to call stored procedures in a standard way for all
DBMSs. A stored procedure is stored in a database; the call
to the stored procedure is what a CallableStatement object
contains. This call is written in an escape syntax that may
take one of two forms: one form with a result parameter,
and the other without one. A result parameter, a kind of
OUT parameter, is the return value for the stored
procedure. Both forms may have a variable number of
parameters used for input (IN parameters), output (OUT
parameters), or both (INOUT parameters). A question mark
serves as a placeholder for a parameter
BatchUpdates:
A batch update is a set of multiple update statements that
is submitted to the database for processing as a batch.
Sending multiple update statements to the database together
as a unit can, in some situations, be much more efficient
than sending each update statement separately. This ability
to send updates as a unit, referred to as the batch update
facility, is one of the features provided with the JDBC 2.0
API.

Is This Answer Correct ?    36 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is queue in java?

795


What are wrapper classes in java?

791


What is a class instance variable?

835


How do you remove duplicates from an array in java?

706


What is formatted output?

724


When does a class need a virtual destructor?

736


Can we access the non-final local variable, inside the local inner class?

759


Who found java?

763


What is the static field modifier?

810


Is it possible to compare various strings with the help of == operator? What are the risks involved?

829


What is the role of the java.rmi.naming class?

711


What is null data type?

710


What are instance variables?

807


What is update method called?

867


What is methods and methodology?

773