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
How to call one constructor from the other constructor ?
What is the meaning of nullable?
Why are the objects immutable in java?
What is :: operator in java?
Can we override the static methods?
When should you use arraylist and when should you use linkedlist?
Can we have multiple public classes in a java source file?
Do we need to manually write Copy Constructor?
What is intern method in java?
What is the difference between compile-time polymorphism and runtime polymorphism?
What is the largest data type in java?
What is thread safe in java?
What is the original name of java?
Can we use synchronized block for primitives?
What is used of static keyword in java?