Answer Posted / gajendra
We can use CallableStatement interface to call a stored
procedure.Use the following steps.
1. crate the escape syntax like
String sql="{call procname(?,?,?);
2.CallableStatement cst=con.prepareCall(sql);
3.Set the inparameters using setXXX methods like
cst.setInt(1,10);
cst.setString(2,"abc");
4.Register the out parameter
cst.registerOutParameter(1,Types.Float);
5.Submit the statement using
cst.execute();
6. We can get the data from stored procedure using getXXX
methods
| Is This Answer Correct ? | 4 Yes | 4 No |
Post New Answer View All Answers
What is mysql driver class name?
What do you mean by checked exceptions?
What is variable length arguments in java?
what is anonymous class in java?
How is hashcode calculated in java?
How do you reverse a string in java without using string buffer?
What does sizeof return?
What is a map in java?
What is the use of hashmap in java?
What is difference between static class and singleton pattern?
What is the use of flag?
Can we use different return types for methods when overridden?
Is it possible for yielded thread to get chance for its execution again ?
How do you escape json?
Differentiate between a class and an object.