callable is interface or class ?
Answers were Sorted based on User's Feedback
Answer / mrangababu
callable is an interface . purpose is to call procedures.
| Is This Answer Correct ? | 10 Yes | 1 No |
Answer / anjani kumar jha
always remember,there r three types of statement interface
in java
1)statement
2)prepared statement
3)callable statement
| Is This Answer Correct ? | 7 Yes | 1 No |
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 |
Answer / kuldeep raaj sharma
The Statement is an interface and its subclasses are
PreparedStatement and CallableStatement.
The Statement interface defines methods for executing SQL
statements that do not contain parameter markers. The
PreparedStatement interface adds methods for setting input
parameters, and the CallableStatement interface adds
methods for retrieving output parameter values returned
from stored procedures.
The CallableStatement interface extends PreparedStatement
with methods for executing and retrieving results from
stored procedures.
Creating a CallableStatement Object
As with Statement and PreparedStatement objects,
CallableStatement objects are created by Connection
objects. CODE EXAMPLE 13-18 shows the creation of a
CallableStatement object for calling the stored
procedure ‘validate’, which has a return parameter and two
other parameters.
CallableStatement cstmt = conn.prepareCall(
“{? = call validate(?, ?)}”);
Setting Parameters
CallableStatement objects may take three types of
parameters: IN, OUT, and
INOUT. The parameter can be specified as either an ordinal
parameter or a named
parameter. A value must be set for each parameter marker in
the statement.
The number, type, and attributes of parameters to a stored
procedure can be
determined using the DatabaseMetaData method
getProcedureColumns.
Parameter ordinals, which are integers passed to the
approriate setter method, refer to the parameter markers
("?") in the statement, starting at one. Literal parameter
values in the statement do not increment the ordinal value
of the parameter markers.
In CODE EXAMPLE the two parameter markers have the ordinal
values 1 and 2.
CallableStatement cstmt = con.prepareCall(
"{CALL PROC(?, "Literal_Value", ?)}");
cstmt.setString(1, "First");
cstmt.setString(2, "Third");
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / samsudeen
its interface , used for call the procedure, and able to
call the query
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / anjani kumar jha
yes
1)statement
2)prepared statement
3)callable statement
all r interface
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / vikaas
Callable is an Interface, used to call Stored Procedures.
| Is This Answer Correct ? | 1 Yes | 0 No |
is that compulsory to have Primarykey-forignkey for joints (outer inner,equal)
What is jdbc and jpa?
What is an escape syntax?
Once I have the Java 2 SDK, Standard Edition, from Sun, what else do I need to connect to a database?
How to get the Database server details in java program?
Give a way to check that all result sets have bin accessed and update counts are generated by execute method.
Why would you use setautocommit(false) in jdbc?
What are the steps involved in establishing a connection using jdbc in java?
What is de-normalization?
What are the measures to connect to the db using jdbc?
What is layer in communication?
What is jdbc driver for sql server?