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
Why java is made?
Explain naming conventions for packages?
Is static a keyword in java?
What are peerless components?
Can finally block be used without a catch?
If an object is garbage collected, can it become reachable again?
What is %02d?
Does sprintf add a null terminator?
What is the difference between Java Program Constructor and Java Program Method, What is the purpose of Java Program constructor Please Explain it Breafily?
What is a generic type?
Can we pass a primitive type by reference in java? How
What is a copy constructor in java?
What is collection sort in java?
Explain all java features with real time examples
What is the advantage of functional interface in java 8?