Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

callable is interface or class ?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the reason why we need a jdbcrowset like the wrapper around resultset?

922


What is difference between odbc and jdbc?

939


Is jdbc an api?

1027


What is jdbc driver manager?

898


What are types of jdbc drivers?

947


The new features of the JDBC 2.0 API, will be supported for JDBC-ODBC Bridge?

2198


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

908


Write an sql to find all records having all upper case alphanumeric characters in a field ?

897


How are jdbc statements used?

889


Explain about multiple implementations and drive manager?

991


What is jdbc driver in java?

879


What is use of connection pooling?

892


Can we have foreign key reference to a non primary key column ?

909


Does jpa use jdbc?

864


What do you mean by odbc?

958